[LUNI] shell scripting question...
Andrew Close
aclose at gmail.com
Sun Apr 5 15:02:21 CDT 2009
On Sun, Apr 5, 2009 at 12:13 PM, Constantin Gavrilescu
<costi at apluscompuservices.com> wrote:
> make a test.sh file with this content:
>
> #!/bin/bash
> echo $0
>
> do a chmod +x test.sh
> Run it with ./test.sh
> It outputs "./test.sh".
>
> Now make a symbolic link to that file:
> ln -s test.sh script.sh
>
> Run the symbolic link. It will output "./script.sh".
>
> Now you know that a which symlink is calling the program. You can go from
> there to:
>
> ln -s test.sh "test param1 param2 param3.sh"
>
> You created a symbolic link with params. Change test.sh to:
>
> #!/bin/bash
> PROGRAM_NAME=$0
> echo first parameter is : `echo ${PROGRAM_NAME} | awk '{print $2}'`
> echo second parameter is : `echo ${PROGRAM_NAME} | awk '{print $3}'`
>
> Now you are passing parameters through symbolic links.
Thanks Constantine, i'll give that a try.
--
Andrew Close
More information about the LUNI
mailing list