LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   script and utilities (https://www.linuxquestions.org/questions/linux-newbie-8/script-and-utilities-242499/)

ef_ 10-14-2004 05:31 AM

script and utilities
 
Hi,
I have a questi'

If I want to write a utlity similar to ls, etc, should I write it as script?

and how in the script I can seperate th eopt that I recieved in ' - '? getops?

10x.

hw-tph 10-14-2004 06:19 AM

Well...not really. Is there any need to create "another" ls?

If you want to learn about Linux shell scripting using Bash I suggest you download the Advanced Bash Scripting Guide. It is an excellent resource and I always keep a copy handy.

Parameters passed to bash scripts can be used as $1 (for the first parameter), $2 and so on, or $* for all the parameters. $0 refers to the script itself.


Håkan

ef_ 10-14-2004 06:42 AM

I meant that I need to write a program that will be utility as ls is.
So , I just wanted to know how utilities are writed. should I do it by script or should it involved make file etc'?


10x.

acid_kewpie 10-14-2004 06:53 AM

ls is written in c, not a scripted language. if you want to learn how to script, then have a look at the bash scripting howto at tldp.org

and can we please drop the "10x"? this isn't an sms conversation. thanks. :)

ef_ 10-14-2004 07:09 AM

so if I want to create a program that will be as utility , I need to write it in c? in the usual way I write c programs?

what is the difference if I'll write it in script wouldn't the result will be the same, I'll be able to run both program in the command line. right?

thanx :-)

hameedkhan 10-14-2004 07:31 AM

hi,
you can write simple to very sophisticated scripts. it depends on your expertise of particular language. and you can run both scripts and c programms (compiled) from command line. for more help on bash scripting read the above recommend (by hw-tph) documentation.

theYinYeti 10-14-2004 08:15 AM

Many shell utilities are themselves written in shell. There is no rule. If I remember correctly, the "time" utility is written in perl or python, I don't remember. And as said, many are in C.

Yves.


All times are GMT -5. The time now is 11:12 PM.