You don't need to use cat with most commands; they take one or more filenames as arguments, and when they don't (as with tr), you can use redirection. With wc youcan use either, but the result is slightly different. In this case, you want redirection:
But you don't even need that. To test whether the file has a non-zero length use the -s option to test:
Quote:
this is to test if the content of out.txt is 0 then message appear that there is no log.
Hi
I got this part of the script from the mimetool by Perderabo.
I have difficulty in decyphering the syntax specially lines 4,5 & 9.
Also the test condition in line 3.
Could someone help me on this please.
--------------------------------------
pwentry=$(grep "^$(logname):" /etc/paswd)... (2 Replies)
Quick question,
File A has one line (10 charachters), File B has one line (10 charachters).
how do a concat these two files together to produce a file (File C) that has the contents of Files A + B together onto one line of 20 Charachters
if I use:
cat FileA FileB > FileC
I get the... (5 Replies)
Hi all,
I am struck with syntax for long time,
Need to purge some lines from given file
Not able to use value of $x
Example of ksh script...
Facing some syntax issue.
Have Tried ‘with single , double ,backtick “” ` and \ escape character , doesn't seem to work.
<line 1> echo $x #... (2 Replies)
To check a bash script syntax without executing it we use:
bash -n scriptname
What should be the equivalent command for checking a ksh script? (8 Replies)
Hi,
I wanted to know what's the difference between the below two syntax used for writing ksh function:
e.g. 1
------
function fn1
{
echo "Hello World"
}
e.g. 2
------
fn1 ()
{
echo "Hello World"
} (4 Replies)
So I am trying to convert my bash script into ksh, and this is what I have in the file so far:
#!/bin/ksh
login()
{
if
then
sendcmd BETA
else
sendcmd "$(xxd -c 32 -g 0 ${ZETA_ZETA} | awk '{print $2}')"
fi
}
But when I run it:
$ ./test.sh ... (1 Reply)
It saves me lot of typing and space/lines when I do not use full 'if' keyword and construct, instead use ..
&& <statement> || <statement>
that perfectly replaces..
if ; then
<statement>
else
<statement>
fi
Can I use following syntax when I want to add multiple statements under 'if'... (4 Replies)
Hi all,
Anyone know why I get the error below under ksh?
$ EXCLUDES=( $(< "$EXCLUDES_FILE") )
sh: syntax error: `(' unexpected
I'm trying to use the above line in a script and it's not working. The guy that gave me the script was running in a linux environment, so I'm thinking this might... (1 Reply)
The syntax of 'if' conditionals in bash and ksh seems different. I am trying to check for a particular version using 'if' in ksh. This very simple syntax gives syntax error. I have tried many variants, but no go. Please correct the syntax. Later I will expand it to 'if' and 'else'.
#!/bin/ksh... (8 Replies)