|
-
Sep 25th, 2002, 09:40 PM
#1
Thread Starter
PowerPoster
Linux Shell?
Anyone ever had a go at writing a Linux/Unix shell? Or know where I can find some good info or tutes?
-RJ
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 26th, 2002, 06:43 AM
#2
Monday Morning Lunatic
No, but you can try and find the POSIX shell interface guidelines (the ones that bash is supposed to be following )
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 26th, 2002, 07:15 AM
#3
Thread Starter
PowerPoster
I know the POSIX guidelines I want to follow. More need implementation stuff. Especially about piping commands, and redirecting output/input...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 26th, 2002, 07:16 AM
#4
Monday Morning Lunatic
popen(), perhaps? 
Or just look at the bash source.
Probably the hardest part is the actually parsing interface, and this is where the readline library comes in...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 26th, 2002, 07:32 AM
#5
Thread Starter
PowerPoster
I have the functions for opening and using a pipe, it's more the design. I'm pretty unfamiliar with Unix/Linux, so I only have a rough idea of how piping works.
What's in the readline lib?
I have a few things I have to do. The first is to make some inbuilt commands, like cd, etc. The second is to implement I/O redirect with >, < operators, and the last is piping.
Gonna be quite a mission for a 2 week job...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 26th, 2002, 07:34 AM
#6
Thread Starter
PowerPoster
P.S - I downloaded the bash source today. It's about...oh... 300 files...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 26th, 2002, 07:37 AM
#7
Monday Morning Lunatic
Huge, isn't it.
But that's because most shells are also programming languages 
The readline library does things like the history, command-line editing, stuff like that.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 26th, 2002, 07:40 AM
#8
Thread Starter
PowerPoster
Sorry, exactly 820 files....
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 27th, 2002, 05:30 AM
#9
In addition to my PM, you might want to look at the glob function, it's quite useful.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 27th, 2002, 08:47 PM
#10
Thread Starter
PowerPoster
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Sep 28th, 2002, 05:15 AM
#11
Monday Morning Lunatic
It performs "globbing", otherwise known as filename expansion. For example, if I glob the following:
Code:
mike@relativity ~] > ls *.txt {a,b,c}.dat
it could possibly expand this to:
Code:
ls z.txt ache.txt lada.txt a.dat b.dat c.dat
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 28th, 2002, 06:57 AM
#12
Yes, I was right amidst writing a set of classes to do this when I stumbled upon this function.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 28th, 2002, 06:53 PM
#13
Thread Starter
PowerPoster
Ok, will check it out. 
Oh wait, that doesn't work here...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|