hi tapananand my sript is about adding permission for execution of script, instead of every time giving command "chmod 744 <filename>" for new shell scripts for adding execute permission, using this program i will send the file name as input that will store in $1 and it should change the permission and show the output.
My script is 'ss4'
Usage: ss4 <filename>
chmod 744 $1
i execute this script like this
$ ./ss4 <filename>
after execution i am getting error as "./ss4: line 6: ss1: command not found"
First of all put code using code button. Secondly when putting code just put the code. What is this Usage and all. We don't need this. Your script is not clear at all. What is line 6? Nothing is clear. You'll struggle to get answers here if you post like this.
I assume this is a shell script. When you execute the argument as a command, it has to be found in the system's PATH environment. Try ./$1 instead. That tells the shell to look for the command (argument) in the local directory, where you executed the ss4 command.
It's kind of bothering me now (I don't write bash scripts too too often, and they are generally for simple tasks). If we use ./$1 to execute the argument, then we are asumming that $1 is a relative path. Shouldn't there be a way to execute it given a path that may either be absolute or relative? I mean, we can start pulling out the heavier logic and check for a leading /, however I feel there should be a simpler way.