hello all
I am written a script that would put a line of text and a file into two different varables for later use, i.e a script called pimp with any number of words and a filename which is the last argument.
so for eg $pimp my name is the name given to me when i was born Afile
where pimp is the script name
"my name ...... born" is the line of text
and Afile is a name of the file.
I can get the filename since is the last argument but how can i get the remaining argument
this is what i have done.
for arg in "$@"
do
: # nothing
done
echo "the last command line argument is $arg"
i quiet understand but the $1 would not show the file name it would be part of the word.
i want to capture the last argument and at the same time able to use the rest of the arguments.
so
pimp my name is joe afile
where pimp is the name of the script
my name is joe = a text
afile = name of a file that exist in my home directory
so jow do i capture the afile and d same time able to use my name is joe later