944,199 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 11706
  • Perl RSS
Aug 13th, 2005
0

A simple perl script

Expand Post »
Hi folks,

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

There are 25 commands executed in following sequence
Perl Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
satimis is offline Offline
67 posts
since Oct 2004
Dec 7th, 2005
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mforeman is offline Offline
11 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: who here can do perl?
Next Thread in Perl Forum Timeline: Trouble Expanding a bus in PERL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC