Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-14-2004, 05:31 AM   #1
LQ Newbie
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
script and utilities

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?

Old 10-14-2004, 06:19 AM   #2
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
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.


Last edited by hw-tph; 10-14-2004 at 06:22 AM.
Old 10-14-2004, 06:42 AM   #3
LQ Newbie
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
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'?

Old 10-14-2004, 06:53 AM   #4
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
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

and can we please drop the "10x"? this isn't an sms conversation. thanks.
Old 10-14-2004, 07:09 AM   #5
LQ Newbie
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
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 :-)
Old 10-14-2004, 07:31 AM   #6
LQ Newbie
Registered: Oct 2004
Location: Karachi, Pakistan
Distribution: Slackware, SuSe, Ubuntu, CentOS
Posts: 19

Rep: Reputation: 0
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.
Old 10-14-2004, 08:15 AM   #7
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 63
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Utilities antidelldude Linux - Newbie 3 01-12-2005 05:32 PM
Are there utilities to do this? jbrush Linux - Newbie 2 12-06-2004 12:00 PM
installing utilities neon Linux - Newbie 2 08-17-2003 11:40 AM
toshiba utilities evian Linux - Software 3 05-05-2003 12:51 AM
LM utilities maddog Linux - Hardware 3 07-19-2002 03:04 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration