Skip to main content

All Questions

Tagged with
148 votes
11 answers
55k views

What is the difference between $* and $@?

Consider the following code: foo () { echo $* } bar () { echo $@ } foo 1 2 3 4 bar 1 2 3 4 It outputs: 1 2 3 4 1 2 3 4 I am using Ksh88, but I am interested in other common ...
rahmu's user avatar
  • 20.1k
3 votes
2 answers
1k views

issues with GNU tail -f and combination of commands

$ tail -f /logs/filename.log | awk '!(/list)' I am able to run this command in GNU Linux flavour But when I written in a script it is not working. test.ksh: variable="/logs/filename.log | awk '!(/...
Manoj's user avatar
  • 31
22 votes
2 answers
1k views

Why escape trivial characters in shell script?

I just opened a legacy shell script (written in old ksh88 on Solaris) and found the following repeated all throughout the code: [ -f $myfile ] && \rm -f $myfile The escaping backslash ...
rahmu's user avatar
  • 20.1k
129 votes
4 answers
52k views

Why does parameter expansion with spaces without quotes work inside double brackets "[[" but not inside single brackets "["?

I'm confused with using single or double brackets. Look at this code: dir="/home/mazimi/VirtualBox VMs" if [[ -d ${dir} ]]; then echo "yep" fi It works perfectly although the string contains a ...
Majid Azimi's user avatar
  • 3,108

15 30 50 per page
1
2