Bash tips and trick
Sunday, February 12, 2006
${var-default} If var is not set, use a default
$ echo $username
null
$ echo ${username-`whoami`}
islandjoe
echo $username
null
posted by Arthur Kho Caayon at
12:55 AM
0 Comments:
Post a Comment
<< Home
Previous Posts
If arg is empty print the current working director...
How to get the parent directory of a folder
Special characters and operators
Print only line 58 of a text file: $ sed -n '58...
Batch renaming of files$ rename 's/\s+/_/g' *.mp3R...
The set command#!/bin/shset `date`echo "Time: $4 $...
Positional parametersmyscript.sh:#!/bin/shecho $0 ...
Ignore case in grep$ grep -i 'camelCaseWhatever' f...
sed: Swap two words around$ cat testfirst:secondon...
sed: Enclose a word in angle-bracketss/html/<&>/re...
0 Comments:
Post a Comment
<< Home