I want to merge all files into one. Here, the last argument is the destination file name. I want to take last argument and then in loop stop before last arguments.
Here code is given that I want to implement:
echo "No. of Argument : $#"
for i in $* - 1
do
echo $i
cat $i >> last argument(file)
done
How to achieve that?
target="$1"; shift; cat "$@" > "$target"
and it would not rely on Bash. The GNU commandsmv
andcp
have been modified to support an option-t destination
to specify a destination directory, which is similar to what I propose.