The tag has no wiki summary.

learn more… | top users | synonyms

25
votes
3answers
7k views

How to pass parameters to an alias?

For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias?
15
votes
1answer
510 views

How do ${0##*/} and ${0%/*} work?

I'm quite confused about the following regular expressions I found in a shell script: ${0##*/} ${0%/*} How do they work?
1
vote
1answer
802 views

Is it possible to use a parameter within an alias command [duplicate]

Possible Duplicate: How to pass parameters to an alias? As answered in Can less retain colored output? I want to use git diff --color=always filename | less -r to get a colored output of my ...
13
votes
2answers
1k views

What does `:-` mean in a shell script

I saw this in the end of an awesome shell script but I can't understand the login here because I think it's being short-handed for a longer command. spark ${@:-`cat`} This apears at the end of this ...
12
votes
0answers
356 views

Should I use $* or $@? [duplicate]

Which one of $* or $@ is better to use (in array syntax,command line parameters, etc.) to avoid any bugs/problems in code? Or it does not make any difference?
12
votes
2answers
2k views

How to safely pass variables to root-enabled scripts?

This question is totally general and not only applicable to my situation, but... I have a small busybox appliance where I want a non-root user to be able to execute a particular script with root ...
2
votes
3answers
130 views

Why are POSIX Find Parameters Different from Other Program styles?

Why is a parameter in the POSIX find command added with a single hyphen for multi-character parameter names, while most other programs use single hyphen to indicate multiple single-character flags, ...