A simple perl script

Reply

Join Date: Oct 2004
Posts: 57
Reputation: satimis is an unknown quantity at this point 
Solved Threads: 0
satimis satimis is offline Offline
Junior Poster in Training

A simple perl script

 
0
  #1
Aug 13th, 2005
Hi folks,

I'm prepared to write a simple perl scripts as follow

There are 25 commands executed in following sequence
  1. export LFS=/mnt/lfs
  2. mount /dev/hda6 /mnt/lfs
  3. mkdir -p $LFS
  4. echo $LFS
  5. /mnt/lfs (output)
  6. /usr/sbin/chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h
  7. mknod -m 600 /dev/console c 5 1
  8. mknod -m 666 /dev/null c 1 3
  9. mount -n -t tmpfs none /dev
  10. mknod -m 622 /dev/console c 5 1
  11. mknod -m 666 /dev/null c 1 3
  12. mknod -m 666 /dev/zero c 1 5
  13. mknod -m 666 /dev/ptmx c 5 2
  14. mknod -m 666 /dev/tty c 5 0
  15. mknod -m 444 /dev/random c 1 8
  16. mknod -m 444 /dev/urandom c 1 9
  17. chown root:tty /dev/{console,ptmx,tty}
  18. ln -s /proc/self/fd /dev/fd
  19. ln -s /proc/self/fd/0 /dev/stdin
  20. ln -s /proc/self/fd/1 /dev/stdout
  21. ln -s /proc/self/fd/2 /dev/stderr
  22. ln -s /proc/kcore /dev/core
  23. mkdir /dev/pts
  24. mkdir /dev/shm
  25. mount -t devpts -o gid=4,mode=620 none /dev/pts
  26. mount -t tmpfs none /dev/shm

In normal circumstance there is no output on all commands except command-4 with "/mnt/lfs" as output. If not considering the output it will be quite simple just listing all commands on a shell script. Now I expect to arrange the script as follows;

1) The script will automatically continue to execute command-5 if the output of command-4 is "/mnt/lfs" otherwise exit the shell.
2) If there is an output on any command it needs to confirm "yes/no" with the corresponding command displayed on the terminal. 'yes" will continue on next command. "no" will exit the shell stopping the script.

I'm considering whether shell script or perl script will do the job better. If perl script then how to start. Which module/modules will be more appropriate, TIA

B.R.
satimis
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 11
Reputation: mforeman is an unknown quantity at this point 
Solved Threads: 0
mforeman mforeman is offline Offline
Newbie Poster

trying to expand a bus in a file in PERL or UNIX

 
0
  #2
Dec 7th, 2005
I am trying to list out a bus as individual names.

For instance - When I come across a section in a file that lists a bus like this:

[0:2] <busname>

I would like to print out this:

<busname>[0]
<busname>[1]
<busname>[2]

Any ideas in PERL or UNIX would be appreciated.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC