[solved] awk: return code from system() always 0 ??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [solved] awk: return code from system() always 0 ??
# 8  
Old 07-11-2013
To simplify my blathering it comes down to this:

Works:
Code:
$ echo "test1; test2"

Does not work:
Code:
$ awk 'END{system("echo test1; test2")}' bla
test1
sh: test2: command not found

Any ideas? As said, escaping and trying single quotes etc. didn't help so far.

Update:
Sorry guys, maybe I am not able to see the wood for the trees at the moment ...
Escaping worked for this case easily:
Code:
$ awk 'END{system("echo \"test1; test2\"")}' bla
test1; test2

I am currently trying to figure that out in a garbled sprintf() with lots of these. I think I am done more or less. Thanks all for trying to help. As often, the problems sits in front of the computer Smilie
I have to enclose every semicolon like a=aaa"\;\"b=bbb to make it work.

Last edited by zaxxon; 07-11-2013 at 10:40 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

[Solved] Redhat system is not booting in GUI mode

Hi Guys Required help in Redhat 6.1. After installation of Redhat 6.1 in VMware system is not going in GUI mode. please to solve the issue... Thanks... (5 Replies)
Discussion started by: deviltech
5 Replies

2. Shell Programming and Scripting

[Solved] Process dies when launched in system startup script

Good morning! I'm trying to add Maven to the system boot by the moment without success. Testing the operation of the script I realize that the process isn't persistent when the program is launched with the start option. ---- #Startup Script ---- #! /bin/sh # chkconfig: 345 99 1 #... (5 Replies)
Discussion started by: carpannav
5 Replies

3. HP-UX

[Solved] Increase the file system size

Dear Friends, I would like to increase the size of a file system from 10GB to 15GB. System is runing on HP-UX 11.31. Please help in the matter. Regards, Bhagawati Pandey (3 Replies)
Discussion started by: BPANDEY
3 Replies

4. HP-UX

[Solved] Mount HP-UX File System in Windows 7

Hello, We just got a rx4640 that is running on: HP-UX B.11.31 U ia64 2426088954 unlimited-user license There is a plenty of space in it and we would like to use it for storage. I can access with ftp and place the files in there but i need to mount the file system in every PC that is running... (7 Replies)
Discussion started by: gjk
7 Replies

5. Shell Programming and Scripting

Managing awk return code over SSH command

Hello all, This bellow code works. I'm just trying to find a simplified way to achieve this. I'm sure there is an easier way and it must be to simple for me to find. Verify that the OS version is 6.1. If not exit the script. Of course if i just put a && exit 1 at the end of the ssh... (11 Replies)
Discussion started by: maverick72
11 Replies

6. Shell Programming and Scripting

[Solved] File System Monitoring Script

Hello Scripts Guru I had created a shell script to monitor the threshold of the file system, but some where it is not giving the correct output. Request to all to hel me out I am getting the following output /dev/vg00/lvol3 mounted on 1865224 10% / is 2097152% /dev/vg00/lvol1 mounted on... (2 Replies)
Discussion started by: indrajit_renu
2 Replies

7. Shell Programming and Scripting

C, sh, perl, system(): Can't transfer a return code appropriately: help, pls

I am using a perl-script from C-code, executing it by the 'system(..)' comand. The problem is to return the perl-return code to the C correctly. Default the 'system()' shell is Bourne: sh My try: (perl_src.c_pl - the perl script; t_sys - C-program with system() call (I will show it... (7 Replies)
Discussion started by: alex_5161
7 Replies

8. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

9. Programming

Return code from system()

Hi, Can any one help me in knowing how can I get the return codes/Error codes when using the system() command to fork a command? Regards, MK (1 Reply)
Discussion started by: mradulkaushik
1 Replies

10. Programming

How to get system() function executed cmd return value ?

Hi, How I can get system function executed command return value ? I want to know mv command success or not ? #include <stdio.h> main() { int ret; ret = system( "mv x.dat y.dat" ); printf( "system ret:\n", ret ); } (3 Replies)
Discussion started by: haiudhaya
3 Replies
Login or Register to Ask a Question