- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Bourne shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 08:57 PM
04-21-2003 08:57 PM
Bourne shell script
write a Bourne shell that will allow a user to specify a number of files to be printed and which email the user with the results of the command. The script should email the user a list of the files that were sent to the printer as well as a list of the files that could not be sent to the printer.
i tried to do this but wont work...please help...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:21 PM
04-21-2003 09:21 PM
Re: Bourne shell script
It would be good if you could post out your script so that we may debug it.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:32 PM
04-21-2003 09:32 PM
Re: Bourne shell script
then
echo "Usage:./printfile directory_name" 1>&2
exit 1
else
cd $1 ls ; (ls | wc -w)
echo "Number of files to be printed: " 1>&2
read fileNo
while [ !$fileNo ]
do
lpr -P[printer]
lpr -m logname
done
fi
i dunno wat to do...quite embarassing to show my script actually
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:40 PM
04-21-2003 09:40 PM
Re: Bourne shell script
is this some kind of a home work u r looking for? :-(
do u have a script already built. if yes, pls post it. we can try to fix it.
hth
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:44 PM
04-21-2003 09:44 PM
Re: Bourne shell script
try this for checking if the lpr command returned successfully -
res=`lpr -P
if [[ $res -ne 0 ]]; then
echo "error occured while printing $docname"
else
echo "successfully printed $docname"
fi
HTH.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:45 PM
04-21-2003 09:45 PM
Re: Bourne shell script
try this for checking if the lpr command returned successfully -
res=`lpr -P
if [[ $res -ne 0 ]]; then
echo "error occured while printing $docname"
else
echo "successfully printed $docname"
fi
HTH.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:46 PM
04-21-2003 09:46 PM
Re: Bourne shell script
try this for checking if the lpr command returned successfully -
res=`lpr -P
if [[ $res -ne 0 ]]; then
echo "error occured while printing $docname"
else
echo "successfully printed $docname"
fi
HTH.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 09:48 PM
04-21-2003 09:48 PM
Re: Bourne shell script
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 10:16 PM
04-21-2003 10:16 PM
Re: Bourne shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 10:26 PM
04-21-2003 10:26 PM
Re: Bourne shell script
Try the attached script.
call as ./sh.sh
ensure that execute permissions are available. if not, run
chmod +x sh.sh
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 10:39 PM
04-21-2003 10:39 PM
Re: Bourne shell script
Type this:chmod +x sh.sh says
chmod: getting attributes of `sh.sh' : No such file or directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 11:04 PM
04-21-2003 11:04 PM
Re: Bourne shell script
I guess you are a newbie to shell programming and also working in unix.
I suggest the following -
- learn to work in linux and how to use the shell - try to run small shell scripts - learn about absolute paths, relative paths, what './' and '../' say, refer to.
- read books on unix shell programming. you will find quite a few if you search in the www
- try out some easy programs which are given in the books above.
- all this will definitely help you to debug your problem.
the script i've given is to be copied onto your machine, in a directory say /tmp.
you may cd /tmp and then run as i'd suggested, or run it from your home directory as
$ /tmp/sh.sh
here are a few links to linux tutorials -
1. http://www.tldp.org/LDP/abs/html/
2. http://steve-parker.org/sh/sh.shtml
3. http://librenix.com/?inode=1774
you can search at google with the keywords
bash programming scripting tutorial
HTH.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2003 11:15 PM
04-21-2003 11:15 PM