# echo "Test 1" ; echo "Test 2"
Test 1
Test 2
# echo -n "Test 1" ; echo "Test 2"
Test 1Test 2
/temp/somefile.txt
, and just want the filename,
you can strip away the path as follows:
# somevar="/etc/mail/access"
# echo ${somevar##*/}
access
Operator | True If |
---|---|
string1 = string2a | string1 matches string2 |
sring1 != String2 | string1 doesn't match string2 |
string1 < string2 | string1 is less than string2 |
string1 > string2 | string1 is greater than string2 |
-n string1 | string1 is not null, i.e. it has a length greater than 0 |
-z string1 | string1 is null, i.e. it has a length of 0 |
sed -e '/^$/d' temp.txt
sed -e '/^$/d' temp.txt >newfile.txt
sed -e /^$/d "$1"
remove-blank-lines myfile.txt
, then inside the
bash script $1 represents the first argument, i.e. myfile.txt
in this case. Putting it in double quotes allows whitespace
and special characters to be part of the filename.References:
Created: July 29, 2005