Skip to content

Instantly share code, notes, and snippets.

@fabiomontefuscolo
Created June 26, 2018 21:04
Show Gist options
  • Save fabiomontefuscolo/3a9b673dce790dfaca45e956147545be to your computer and use it in GitHub Desktop.
Save fabiomontefuscolo/3a9b673dce790dfaca45e956147545be to your computer and use it in GitHub Desktop.
savestdin.sh
#!/bin/bash
function show_usage() {
echo "$1 [CAT_OPTIONS] filename"
}
if [ "${#}" -lt 1 ];
then
show_usage "$0";
exit -1;
fi
args="${@:1:$#-1}"
filename="${@:$#}"
set --
for arg in "${args[@]}";
do
set -- "$@" "$arg";
done
cat $@ > $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment