- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help needed!!! Perl went for nuts
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
02-15-2006 07:27 PM
02-15-2006 07:27 PM
This is simple prog:
#!/usr/bin/perl -w
system('/usr/bin/ls aaa');
It works fine and $? = 0
But this prog:
#!/usr/bin/perl -w
system('/usr/bin/ls aaa >bbb');
doesn't work, and $?=65280, $!='No such file or directory'
'/usr/bin/ls aaa >bbb' started manually works fine.
What happens?
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 07:34 PM
02-15-2006 07:34 PM
Solutioncan you put the script under perl debgger and see what happens there ? Something like,
#perl -d tmp.pl
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(tmp.pl:2): system('/usr/bin/ls aaa >bbb');
DB<1>
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 07:36 PM
02-15-2006 07:36 PM
Re: Help needed!!! Perl went for nuts
# perl -d a.pl
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(a.pl:2): system('/usr/bin/ls aaa >/tty');
DB<1> n
main::(a.pl:3): print $!,"\n", $?, "\n";
DB<1> p $?
65280
DB<2> p $!
No such file or directory
DB<3>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 07:38 PM
02-15-2006 07:38 PM
Re: Help needed!!! Perl went for nuts
# perl -d a.pl
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(a.pl:2): system('/usr/bin/ls aaa >bbb');
DB<1> n
main::(a.pl:3): print $!,"\n", $?, "\n";
DB<1> p $?
65280
DB<2> p $!
No such file or directory
DB<3>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 07:59 PM
02-15-2006 07:59 PM
Re: Help needed!!! Perl went for nuts
what happens when you open bbb yourself?
open BBB, "> bbb" or die "Cannot write to bbb: $!\n";
close BBB;
system ("ls aaa > bbb") or die "ls failed: $!";
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:10 PM
02-15-2006 08:10 PM
Re: Help needed!!! Perl went for nuts
system - no. File bbb is empty after system ("ls aaa > bbb") or die "ls failed: $!";
die doesn't executed because system returns 65280.
# perl -d a.pl
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(a.pl:10): system ("ls aaa > bbb") or die "ls failed: $!";
DB<1> n
main::(a.pl:12): 0;
DB<1> p $?
65280
DB<2> p $!
No such file or directory
DB<3>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:11 PM
02-15-2006 08:11 PM
Re: Help needed!!! Perl went for nuts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:24 PM
02-15-2006 08:24 PM
Re: Help needed!!! Perl went for nuts
# cat test.pl
#!/usr/bin/perl -w
`/usr/bin/ls muthu > /err.log`;
# perl -d test.pl
DB<1> n
what you are getting now?
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:29 PM
02-15-2006 08:29 PM
Re: Help needed!!! Perl went for nuts
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(b.pl:2): `/usr/bin/ls muthu > /err.log`;
DB<1> n
main::(b.pl:3): 1;
DB<1> p $?
256
DB<2> p $!
DB<3>
/err.log - is not created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:34 PM
02-15-2006 08:34 PM
Re: Help needed!!! Perl went for nuts
# cat test.pl
#!/usr/bin/perl -w
`/usr/bin/ls muthu > /err.log`;
# perl -W test.pl
what you are getting?
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:41 PM
02-15-2006 08:41 PM
Re: Help needed!!! Perl went for nuts
#
err.log is not created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:42 PM
02-15-2006 08:42 PM
Re: Help needed!!! Perl went for nuts
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:45 PM
02-15-2006 08:45 PM
Re: Help needed!!! Perl went for nuts
# cat > test.pl
#!/usr/bin/perl -w
`/usr/bin/ls muthu > /err.log 2>&1`;
# perl test.pl
# cat /err.log
what you are getting. I feel it is a problem with STDERR (2 File descriptor) setup.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 09:20 PM
02-15-2006 09:20 PM
Re: Help needed!!! Perl went for nuts
It seems that during of reboot /bin (symlink to /usr/bin) was removed (fsck?)
After recreating symlink all orks fine !!!
Thank to all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 09:22 PM
02-15-2006 09:22 PM