otrdiena, augusts 16, 2005

Bash Tricks

Save typing
cp /a/long/path/to/my/file{,.bak}

Reverse search in history
Crtl+r
(reverse-i-search)`us’: ls -l /usr/bin/sudo

Simple loops
for i in $(cat users.txt); do e=`dd if=/dev/urandom ibs=3 count=2 2>/dev/null | uuencode -m /dev/stdout | sed -n “2p”`; echo $i:$e; done

for i in *; do cp $i $i.bak; done

Avots: Prentice Bisbal, “My favourite bash Tips and Tricks”, Linux Journal, April, 2005

Nav komentāru: