grep omit empty lines:
cat <something> | grep -v "^$" |
I keep forgetting this regexp of “match expression at the star of the line”: the “^”
grep omit empty lines:
cat <something> | grep -v "^$" |
I keep forgetting this regexp of “match expression at the star of the line”: the “^”
Checking whether /dev/video0
or
/dev/ttyUSB0
exists or not (module is installed & probed). They're recognized as "character special file" in
bash
[ -b /dev/ttyUSB0 ] && echo "char special file found" || echo "char special file not found" |
Compare the above to "block special file"
[ -b /dev/sda ] && echo "block special file found" || echo "block special file not found" |
Unix time conversion
$ EPOCH=1297515579843 $ echo $EPOCH | cut -c1-10 1297515579 $ echo $EPOCH | cut -c1-10 | awk '{print strftime("%c",$1)}' Sat 12 Feb 2011 07:59:39 PM WIT |
$ sleep 120 && touch 120 & sleep 4 && touch 4
So, how are those file touch
comes up in sequence (watch the creation time)
$ ls -l total 160 -rw-r--r-- 1 arif arif 0 2010-03-17 17:28 120 -rw-r--r-- 1 arif arif 0 2010-03-17 17:27 4 ... |