I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into.
main.sh
#!/bin/ksh
getLS.sh > output.txt
getLS.sh
#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!
Basically I'd like to be able to combine the second script into the first and not have to call a second script.
Would this work?
#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!
> output.txt
If it does work, why does it work?
I've always been using the stdout redirect like this:
command > output..
I didn't know you could do
command1
command2
command3
> output..