I think the second error is because there are nothing in $FILENAME because of the first error with basename. This is how to get basename another way: ${1##*/} (if you want it from $1).
I don't understand PATH and FILE in your script, they don't get any values?
I also think you must have a loop in the last part:
Hi All,
I need to store the real seconds of the following command in a variable. How could it be done?
time $(dd if=/dev/zero of=/dev/sda1 bs=512 count=2048;sync)
Thanks,
Amio (12 Replies)
Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
I intend to find the path/full location of a file(filename given by user thru "read filenme") using "find" or any other command and then store it's output in a variable for some other processing.
But struggling to put all things together (i.e finding the fully qualified location of that file and... (4 Replies)
Hello All
Nice to meet you all here in this forum,
it's my 1rst time here
i'm asking about a little issue that i face
i added a ksh script that echo " please insert your name " and store the output to a login.log file.
the script is working fine with normal telnet
but Xstart is not working... (8 Replies)
Hello,
My input files are having header/body/footer. The first three digits finds whether the data is header/body/footer. For example,
010AAAAA 20100507 234KB BBBBBBBBBB_20100506.DAT
020CCCCC DDDDDDDDD 373983983 19750426 456.90 ... (1 Reply)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi
I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this
Enter the line to... (1 Reply)
Hi
I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this
Enter the line... (4 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
LEARN ABOUT CENTOS
sg_sync
SG_SYNC(8) SG3_UTILS SG_SYNC(8)NAME
sg_sync - send SCSI SYNCHRONIZE CACHE command
SYNOPSIS
sg_sync [--16] [--count=COUNT] [--group=GN] [--help] [--immed] [--lba=LBA] [--sync-nv] [--timeout=SECS] [--verbose] [--version] DEVICE
DESCRIPTION
Send SYNCHRONIZE CACHE(10) or SYNCHRONIZE CACHE(16) command to DEVICE. These commands are defined for SCSI block devices (see SBC-3). If
successful these commands make sure that any blocks whose latest versions are held in cache are written to (also termed as "synchronized
with") the medium.
If the LBA and COUNT arguments are both zero (their defaults) then all blocks in the cache are synchronized. If LBA is greater than zero
while COUNT is zero then blocks in the cache whose addresses are from and including LBA to the highest lba on the device are synchronized.
If both LBA and COUNT are non zero then blocks in the cache whose addresses lie in the range LBA to LBA+COUNT-1 inclusive are synchronized
with the medium.
OPTIONS
Arguments to long options are mandatory for short options as well.
-S, --16
performs a SYNCHRONIZE CACHE(16) command. Default is to perform a SYNCHRONIZE CACHE(10) command.
-c, --count=COUNT
where COUNT is the number of blocks to synchronize from and including LBA. Default value is 0. When 0 then all blocks in the cache
from and including LBA argument to the highest block address are synchronized.
-g, --group=GN
where GN is the group number which can be between 0 and 31 inclusive. The default value is 0 . Group numbers are used to segregate
data collected within the device. This is a new feature in SBC-2 and can probably be ignored for the time being.
-h, --help
output the usage message then exit.
-i, --immed
sets the IMMED bit in the SYNCHRONIZE CACHE command. This instructs the device, if the format of the command is acceptable, to
return a GOOD status immediately rather than wait for the blocks in the cache to be synchronized with (i.e. written to) the medium.
-l, --lba=LBA
where LBA is the lowest logical block address in the cache to synchronize to the medium. Default value is 0 .
-s, --sync-nv
synchronize the (volatile) cache with the non-volatile cache. Without this option (or if there is no non-volatile cache in the
device) the synchronization is with the medium. The SYNC_NV bit was made obsolete in SBC-3 revision 35d.
-t, --timeout=SECS
where SECS is the number of seconds the OS allows the SYNCHRONIZE CACHE(16) to complete before it tries to cancel the command. Can-
celling commands (typically with the task management function "abort task") is best avoided. Note this option is only active
together with the --16 option. The default timeout is 60 seconds for both SYNCHRONIZE CACHE(10) and SYNCHRONIZE CACHE(16). Note that
timeout issues can be avoided with the --immed option.
-v, --verbose
increase the level of verbosity, (i.e. debug output).
-V, --version
print the version string and then exit.
NOTES
With the SYNCHRONIZE CACHE(16) command LBA can be up to 64 bits in size and COUNT up to 32 bits in size. With the SYNCHRONIZ CACHE(10) com-
mand LBA can be up to 32 bits in size and COUNT up to 16 bits in size.
Various numeric arguments (e.g. LBA) may include multiplicative suffixes or be given in hexadecimal. See the "NUMERIC ARGUMENTS" section in
the sg3_utils(8) man page.
EXIT STATUS
The exit status of sg_sync is 0 when it is successful. Otherwise see the sg3_utils(8) man page.
AUTHORS
Written by Douglas Gilbert.
REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>.
COPYRIGHT
Copyright (C) 2004-2013 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
SEE ALSO
sg_start(sg3_utils)
sg3_utils-1.37 July 2013 SG_SYNC(8)