keskiviikko 13. helmikuuta 2013

I gotta find(1) a new hobby ...

[wat@were ~]$ find ./test -exec echo a*b;c {} ;
find: -exec: no terminating ";" or "+"
-bash: c: command not found
[wat@were ~]$ find ./test -exec "echo a*b;c {} ;"
find: -exec: no terminating ";" or "+"
[wat@were ~]$ find ./test -exec "echo a*b;c {}" ";"
find: echo a*b;c ./test: No such file or directory
find: echo a*b;c ./test/name with spaces: No such file or directory
find: echo a*b;c ./test/name with even more spaces: No such file or
directory
find: echo a*b;c ./test/just-a-name: No such file or directory
find: echo a*b;c ./test/another-name: No such file or directory
[wat@were ~]$ find ./test -exec "echo" "a*b;c {}" ";"
a*b;c ./test
a*b;c ./test/name with spaces
a*b;c ./test/name with even more spaces
a*b;c ./test/just-a-name
a*b;c ./test/another-name
[wat@were ~]$
... before I get addicted to shellgarbling and become a masochist ~:)

Random encounter!

[ksym@plains ~]$ ls test
another-name                    name with even more spaces
just-a-name                     name with spaces
- A wild pack of filenames_with_spaces appears!
- ksym casts minor shell magic
[ksym@plains ~]$ pos=0; for file in `ls test`; do let pos++; echo $pos:$file; done
- filenames_with_spaces counters with shell_retardation
1:another-name
2:just-a-name
3:name
4:with
5:even
6:more
7:spaces
8:name
9:with
10:spaces
- It is effective! ksym takes damage to SAN!
- ksym uses power_word:IFS
[ksym@plains ~]$ IFS="`printf '\n\t'`"; export IFS
- ksym recasts minor shell magic
[ksym@plains ~]$ pos=0; for file in `ls test`; do let pos++; echo $pos:$file; done
1:another-name
2:just-a-name
3:name with even more spaces
4:name with spaces
- It is Super Effective!
- filenames_with_spaces have been listed sequentially with position number
- ksym won!
[ksym@plains ~]$ 8-)