Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System("...") is ignored

Status
Not open for further replies.

marfi

IS-IT--Management
Feb 5, 2002
1
DE
Hi there,
I have a script that starts another script with 2 parameters that are read from a txt file by awk.
But somehow this line is ignored unter SunOS 5.7
If I replace system("...") with print "..." then the line is executed. I also have all the required right to the file add_printer_liste
Here is my script:
#!/bin/sh
awk '{
print " ";
print "***********************************************";
print "Host:"$1 " Queue: "$2;
system("add_printer_liste -h "$1" -q "$2);
}' drucker.txt
 
Hi marfi,
[ul]
[li]Are you sure that add_printer_liste is in your path ?[/li]
[li]Redirect stdout and stderr to a file to log error messages.[/li]
[/ul]

#!/bin/sh
awk '{
print " ";
print "***********************************************";
print "Host:"$1 " Queue: "$2;
Out = "/tmp/add_printer_liste_" $1 "_" $2 ".out" ;
Cmd = "add_printer_liste " $1 " -q " $2 " > " Out " 2>&1" ;
Sts = system(Cmd);
if (Sts != 0) print "Error: check log file",Out ;
}' drucker.txt
Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top