For Programmers: Free Programming Magazines  


Home > Archive > AWK > June 2007 > execute a sh from within awk









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author execute a sh from within awk
Atropo

2007-06-04, 6:57 pm

nawk on solaris 9

if ( 1 = 1 ) {
cmd="sendfile.ksh "
cmd | getline
close(cmd)
break
{

the sendfile.ksh has this

ftp -nv <<EOF
open #.#.#.#
user ftpuser ftpuserpasswd
put filetoexport.dat
close
bye
EOF

the sendfile.ksh is executed but the awk throw this message
"No control connection for command: Broken pipe" just at the end of
ftp. and the ftp is not done.


TIA.

Ed Morton

2007-06-04, 6:57 pm

Atropo wrote:
> nawk on solaris 9
>
> if ( 1 = 1 ) {
> cmd="sendfile.ksh "
> cmd | getline
> close(cmd)
> break
> {
>
> the sendfile.ksh has this
>
> ftp -nv <<EOF
> open #.#.#.#
> user ftpuser ftpuserpasswd
> put filetoexport.dat
> close
> bye
> EOF
>
> the sendfile.ksh is executed


how do you know? also, ending it in ".ksh" is misleading since without
the shebang, it'll be executed by whatever shell awk chooses.

but the awk throw this message
> "No control connection for command: Broken pipe" just at the end of
> ftp. and the ftp is not done.


Maybe you'll get some insight here:

http://osdir.com/ml/shells.bash.bug...7/msg00032.html

otherwise, you may be better off asking at comp.unix.questions or
comp.unix.shell.

Ed.
Atropo

2007-06-05, 7:57 am

On 4 jun, 17:53, Ed Morton <mor...@lsupcaemnt.com> wrote:
> Atropo wrote:
>
>
>
>
>
> how do you know? also, ending it in ".ksh" is misleading since without
> the shebang, it'll be executed by whatever shell awk chooses.
>
> but the awk throw this message
>
>
> Maybe you'll get some insight here:
>
> http://osdir.com/ml/shells.bash.bug...7/msg00032.html
>
> otherwise, you may be better off asking at comp.unix.questions or
> comp.unix.shell.
>
> Ed.- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -


Really thanks Ed. I'll put the shabang and I'll be R'ngTFM. I guess
whatever the bash it uses is just a simple ftp.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com