- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- POSIX Shell programing issue
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
11-05-2007 09:30 AM
11-05-2007 09:30 AM
I´m a newby in POSIX shell programing and i have this issue:
need to run a program which first ask for an option and again ask for another option and then it starts to refresh some data in the display.
My question is what i can do to get the n the data the program prints in the screen into a text file assuming that i don´t be able to modify such program.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 09:42 AM
11-05-2007 09:42 AM
Re: POSIX Shell programing issue
Let's suppose that you want to capture the output of "ls /etc" to a file:
OUTFILE=/var/tmp/myfile
ls /etc > ${OUTFILE}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 09:42 AM
11-05-2007 09:42 AM
Re: POSIX Shell programing issue
# ./myscript > ./myscript.log
# ./myscript >> ./myscript.log
...the first truncates (clears) 'myscript.log' if it exists or creates an empty file if it doesn't and then writes the output (STDOUT) to it.
The second appends STDOUT to 'myscript.log' adding any new data to that already present.
I suggest this link for a quick overview of the POSIX shell:
http://www.docs.hp.com/en/B2355-90046/index.html
Don't forget to read and keep handy the 'sh-posix(1)' manpages, either:
http://www.docs.hp.com/en/B2355-60105/sh-posix.1.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 09:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 09:53 AM
11-05-2007 09:53 AM
Re: POSIX Shell programing issue
Let's say: run "/tmp/programX pf=/tmp/profile" when the program starts it prompts for an input (at this point i have to hit "m" and then have to hit "l"); the output that comes after all this is the one i need to log into a text file.
The question is how?, any clues?
Thanks and regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 10:02 AM
11-05-2007 10:02 AM
Re: POSIX Shell programing issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 10:02 AM
11-05-2007 10:02 AM
Re: POSIX Shell programing issue
INFILE=/var/tmp/myinfile
OUTFILE=/var/tmp/myoutfile
# The following is a here docs that will
# put an m
cat << !EOF! > ${INFILE}
m
l
!EOF!
myprof pf=xxx < ${INFILE} > ${OUTFILE}
rm -f ${INFILE}
At this point, you would then need to pass ${OUTFILE} through a filter (sed, awk, Perl) and remove your first few extraneous lines.
- Tags:
- redirect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2007 10:08 AM
11-05-2007 10:08 AM
Re: POSIX Shell programing issue
Tim and Clay show me two different ways to do. Now i have to run some test to determine which one of them is the best one for me.
Regards!