Skip to content

Instantly share code, notes, and snippets.

@jgrar
Created May 8, 2014 00:27
Show Gist options
  • Save jgrar/584db7e497d4664385e6 to your computer and use it in GitHub Desktop.
Save jgrar/584db7e497d4664385e6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# f [targets]...
# process targets, reads targets from stdin if no arguments are supplied
f() {
if [ $# = 0 ]
then
while read -r t
do
# do something to t
done
else
for t in $@
do
# do the same something to t
done
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment