LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   while writing your own Bash shell command (https://www.linuxquestions.org/questions/linux-software-2/while-writing-your-own-bash-shell-command-470074/)

basak 08-02-2006 08:26 AM

while writing your own Bash shell command
 
Hi;
I have to write a couple of user defined Bash shell commands but I do not know how I will make these commands have some options(like -o,-l etc.) or have some input or output files as arguments.Thanks..

Matir 08-02-2006 09:23 AM

Are you writing them as shell scripts? Or functions? In either case, all arguments are available in $*, you just need to parse them. Or, if you're concerned with position, you could use $1..$n for "n" arguments.

basak 08-02-2006 09:37 AM

I 'm supposed to write them as shell scripts but from the tutorials I have read so far ,I could not learn how a command recognizes a given valid(or gives an error if it is unvalid) option or uses a given file as an argument.:(

unSpawn 08-02-2006 10:13 AM

Checked your tuts for "getopts"?

johnson_steve 08-02-2006 10:58 AM

Check out the Advanced bash scripting guide:

http://www.tldp.org/LDP/abs/html/


All times are GMT -5. The time now is 10:17 PM.