- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "cannot open input file" with a script using the s...
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-15-2003 10:53 AM
11-15-2003 10:53 AM
split -b nm /dir/inputfile /dir/outputfile
or
split -b nk /dir/inputfile /dir/outputfile
or
split -l n /dir/inputfile /dir/outputfile
as specified by the user. The script is attached.
Problem: If I do everything manually it works fine, but while running the script I am getting the "cannot open input file"... What am I overlooking?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 11:43 AM
11-15-2003 11:43 AM
Re: "cannot open input file" with a script using the split command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 12:00 PM
11-15-2003 12:00 PM
Re: "cannot open input file" with a script using the split command
My upmost apologies. I leave my computer on so my flatmates can browse the internet....it seems now they cannot be trusted. I hope this hasn't discouraged your use of the forum.
If you set a shell echo in your script, i.e. run :
# ksh -x <script>
You will have a better idea where the script is failing.
Again, I am very sorry.
Regards,
James.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 12:22 PM
11-15-2003 12:22 PM
Re: "cannot open input file" with a script using the split command
You might want to add tests for the existance of the file involved into your script.
if [ -f filename $filename ] stuff.
My crib sheet isn't handy right now.
reboot huh?
Sure, it was the roommates.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 01:12 PM
11-15-2003 01:12 PM
Solutionyou have a small error in your script.
split -b $KBSIZEk $WKDIR/$FILENAME $RESDIR/$FILENAME.
The shell evaluates the variable $KBSIZEk because it can not know, that k is not part of the variable name and of course this will
result in nothing, because it is not set.
use ${KBSIZE}k
Now the skell knows, what to evaluate.
Also the 1st line should be
#!/usr/bin/ksh
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 11:41 PM
11-15-2003 11:41 PM
Re: "cannot open input file" with a script using the split command
Michael is completely right about the variables. Iy may be a small error, but small errors tend to be fatal for your scripts.
Your first line is wrong too, as Michael says.
You may want to add a line near the beginning:
set -u # undefined variable -> error
If the shell encounters an undefined variable, it will complain about that.
For debugging, add a 'set -xv'.
Good luck.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2003 11:49 PM
11-15-2003 11:49 PM
Re: "cannot open input file" with a script using the split command
Once again, you guys are great... Thanks!