There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

hatedbad ,

assuming you have a GNU toolchain you can use the find command like so:


<span style="color:#323232;">find . -type f -executable -exec sh -c '
</span><span style="color:#323232;">case $( file "$1" ) in (*Bourne-Again*) exit 0; esac
</span><span style="color:#323232;">exit 1' sh {} ; -print0 | xargs -0 -I{} cp {} target/
</span>

This first finds all executable files in the current directory (change the “.” arg in find to search other dirs), uses the file command to test if it’s a bash file, and if it is, pipes the file name to xargs which calls cp on each file.

note: if “target” is inside the search directory you’ll get output from cp that it skipped copying identical files. this is because find will find them a free you copy them so be careful!

note 2: this doesn’t preserve the directory structure of the files, so if your scripts are nested and might have duplicate names, you’ll get errors.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines