script name

I‘m writing a bash wrapper script that will pass arguments to the command. I need to find out the last argument if I call the wrapper as follows:

./wrapper -a -b –longarg=foo thisfilename.txt
./wrapper -a -b thisfilename.txt
./wrapper -a –next=true thisfilename.txt



Where,

=> $@ is all of them.

=> $0 is script name.

=> $1 is first arg.




I want thisfilename.txt stored in a shell variable called $last. How do I find the last argument passed to a shell script written in bash or ksh under Unix like operating systems?

{ 1 comment }

How do I run a Linux shell script? How can I run a script in Linux operating system using command line options?

{ 12 comments }

How do I execute a script under UNIX or Linux like operating system using command prompt?

{ 1 comment }

How do I execute a script on remote server called server2.example.com from my PC? How to run a shell/python/perl script on remote Unix-like systems?

{ 6 comments }

Can you explains and provide us “Bourne Shell Exit Status Code” examples?

{ 0 comments }