Unix homework

L

loppdawg69

Guest
ok i have some question for my unix homework if you know Unix give me an IM at NateDavv68
 
here are the questions for ya...im stumped

1)the command "dirname path" treats path as a pathnameand writes to the standard output the path prefix, that is everything up to but not including the last component. thus "dirname a/b/c/d" write a/b/c to standard output. If path is simple filename (has no / characters), then dirname writes a . to standard output. Implement "dirname" as a Korn Shell function. Make sure that it behaves sensibly when given values of path such as /.

2)implement the basename utility, which writes the last component of its pathname argument to standard output, as a Korn Shell function. For example

basename a/b/c/d

writes d to standard output.

3) The UNIX basename utility has an optional third argument. If you type suffix of path that is identical to suffix. For example

$ basename src/shellfiles/prog.sh .sh
prog
$ basename src/shellfiles/prog.sh .c
prog.sh

add this feature to the function you wrote for problem 2.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back