I am struggling to understand how getopt can be used in a csh script.
can anybody post a csh script using getopt.
Please!
I am struggling to understand how getopt can be used in a csh script.
can anybody post a csh script using getopt.
Please!
hey Itkamaraj, the code you linked is in bash, i need to run it in csh.
thanks
I dont know, whether u red the full page or not.
In the end of the page, you can see the below lines.
Note: In the C shell, use the following command to run the getopt command:
set argv=`getopt OptionString $*`
Thanks, I regret I did miss it.
I am facing trouble in writing the <optionstring $*> part for getopt. Can you please help me out.
I will write in brief what i have understood,I need you to correct me if i am wrong anywhere.
AS is given in code
set argv = `getopt a:bc $*`
where we are trying to list flags and arguments.
hence a is a flag with arguments and b,c are just flags.
Q) What is the significance of $* after optionstring? is it just syntax? (I know what is $*=list all args)
end of getopt processing: When it has read all tokens or it has encountered a specialtoken --.
The getopt command then outputs the processed flags, a � (double hyphen), and any remaining tokens.
can you explain the bold lines above?
also, we have saved the getopt's output in a argv, so am i correct to say that argv is an array , which stores all output from a. using shift we can pop a recently used value and get ready to access next value.
---------- Post updated at 12:50 PM ---------- Previous update was at 12:15 PM ----------
Can anybody explain this getopt declaration?
set temp=(`getopt -s tcsh -o ab:c:: --long a-long,b-long:,c-long:: -- $argv:q`)
full Code Link
http://software.frodo.looijaard.name/getopt/docs/getopt-parse.tcsh