Command lls not working in script

Advertisement

plois00
Joined:
Posts:
6

Command lls not working in script

Hello,

Would you have any idea as to why the command lls is not working?

Thank you for your help.

Here is my script:
Please note that the same RC is returned if I do not specify "call". Only the output file "lls.chk" is not created at all.

option batch on
option confirm off
cd "/tmp/"
lcd "C:\ftp_tmp\"
option transfer ascii
call lls >lls.chk
close
exit

Here is the log:

. 2008-09-24 13:15:24.430 --------------------------------------------------------------------------
. 2008-09-24 13:15:24.430 WinSCP Version 4.1.6 (Build 412) (OS 5.0.2195 Service Pack 4)
. 2008-09-24 13:15:24.430 Login time: Wednesday, September 24, 2008 1:15:24 PM
. 2008-09-24 13:15:24.430 --------------------------------------------------------------------------
. 2008-09-24 13:15:24.430 Session name: bpd1mk@slsudv53
. 2008-09-24 13:15:24.430 Host name: slsudv53 (Port: 22)
. 2008-09-24 13:15:24.430 User name: bpd1mk (Password: No, Key file: Yes)
. 2008-09-24 13:15:24.430 Tunnel: No
. 2008-09-24 13:15:24.430 Transfer Protocol: SFTP (SCP)
. 2008-09-24 13:15:24.430 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2008-09-24 13:15:24.430 Proxy: none
. 2008-09-24 13:15:24.430 SSH protocol version: 2; Compression: No
. 2008-09-24 13:15:24.430 Bypass authentication: No
. 2008-09-24 13:15:24.430 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2008-09-24 13:15:24.430 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2008-09-24 13:15:24.430 SSH Bugs: -,-,-,-,-,-,-,-
. 2008-09-24 13:15:24.430 SFTP Bugs: -,-
. 2008-09-24 13:15:24.430 Return code variable: Autodetect; Lookup user groups: Yes
. 2008-09-24 13:15:24.430 Shell: default, EOL: 0
. 2008-09-24 13:15:24.430 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2008-09-24 13:15:24.430 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2008-09-24 13:15:24.430 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2008-09-24 13:15:24.430 Cache directory changes: Yes, Permanent: Yes
. 2008-09-24 13:15:24.430 DST mode: 1
. 2008-09-24 13:15:24.430 --------------------------------------------------------------------------
. 2008-09-24 13:15:24.430 Looking up host "slsudv53"
. 2008-09-24 13:15:24.540 Connecting to 172.26.170.27 port 22
. 2008-09-24 13:15:24.770 Server version: SSH-2.0-OpenSSH_4.3
. 2008-09-24 13:15:24.770 We claim version: SSH-2.0-WinSCP_release_4.1.6
. 2008-09-24 13:15:24.770 SSPI: acquired credentials for: plois00@SAFEWAY01.AD.SAFEWAY.COM
. 2008-09-24 13:15:24.770 Constructed service principal name 'host/slsudv53'
. 2008-09-24 13:15:24.770 GSSKEX disabled: The specified target is unknown or unreachable
. 2008-09-24 13:15:24.770 Using SSH protocol version 2
. 2008-09-24 13:15:24.790 Doing Diffie-Hellman group exchange
. 2008-09-24 13:15:24.850 Doing Diffie-Hellman key exchange with hash SHA-1
. 2008-09-24 13:15:25.231 Host key fingerprint is:
. 2008-09-24 13:15:25.231 ssh-dss 1024 b1:1b:fd:c6:60:eb:0a:0b:3b:fd:ca:0c:9a:66:4a:33
. 2008-09-24 13:15:25.231 Initialised AES-256 SDCTR client->server encryption
. 2008-09-24 13:15:25.231 Initialised HMAC-SHA1 client->server MAC algorithm
. 2008-09-24 13:15:25.231 Initialised AES-256 SDCTR server->client encryption
. 2008-09-24 13:15:25.231 Initialised HMAC-SHA1 server->client MAC algorithm
. 2008-09-24 13:15:25.371 Reading private key file "C:\appid.txt"
! 2008-09-24 13:15:25.381 Using username "bpd1mk".
. 2008-09-24 13:15:25.401 Offered public key
. 2008-09-24 13:15:25.431 Offer of public key accepted
! 2008-09-24 13:15:25.431 Authenticating with public key "rsa-key-20061009"
. 2008-09-24 13:15:25.561 Access granted
. 2008-09-24 13:15:25.581 Opened channel for session
. 2008-09-24 13:15:25.612 Started a shell/command
. 2008-09-24 13:15:25.612 --------------------------------------------------------------------------
. 2008-09-24 13:15:25.612 Using SFTP protocol.
. 2008-09-24 13:15:25.622 Doing startup conversation with host.
> 2008-09-24 13:15:25.622 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2008-09-24 13:15:25.642 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2008-09-24 13:15:25.642 SFTP version 3 negotiated.
. 2008-09-24 13:15:25.642 We believe the server has signed timestamps bug
. 2008-09-24 13:15:25.642 We will use UTF-8 strings for status messages only
. 2008-09-24 13:15:25.642 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2008-09-24 13:15:25.642 Getting current directory name.
. 2008-09-24 13:15:25.642 Getting real path for '.'
> 2008-09-24 13:15:25.642 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2008-09-24 13:15:25.672 Type: SSH_FXP_NAME, Size: 59, Number: 16
. 2008-09-24 13:15:25.672 Real path is '/export/home/bpd1mk'
. 2008-09-24 13:15:25.672 Startup conversation with host finished.
. 2008-09-24 13:15:25.672 Cached directory change via "/tmp/" to "/tmp".
. 2008-09-24 13:15:25.672 Getting current directory name.
. 2008-09-24 13:15:25.672 [Shell] Looking up host "slsudv53"
. 2008-09-24 13:15:25.672 [Shell] Connecting to 172.26.170.27 port 22
. 2008-09-24 13:15:25.752 [Shell] Server version: SSH-2.0-OpenSSH_4.3
. 2008-09-24 13:15:25.752 [Shell] We claim version: SSH-2.0-WinSCP_release_4.1.6
. 2008-09-24 13:15:25.752 [Shell] SSPI: acquired credentials for: plois00@SAFEWAY01.AD.SAFEWAY.COM
. 2008-09-24 13:15:25.752 [Shell] Constructed service principal name 'host/slsudv53'
. 2008-09-24 13:15:25.752 [Shell] GSSKEX disabled: The specified target is unknown or unreachable
. 2008-09-24 13:15:25.752 [Shell] Using SSH protocol version 2
. 2008-09-24 13:15:25.782 [Shell] Doing Diffie-Hellman group exchange
. 2008-09-24 13:15:25.832 [Shell] Doing Diffie-Hellman key exchange with hash SHA-1
. 2008-09-24 13:15:26.272 [Shell] Host key fingerprint is:
. 2008-09-24 13:15:26.272 [Shell] ssh-dss 1024 b1:1b:fd:c6:60:eb:0a:0b:3b:fd:ca:0c:9a:66:4a:33
. 2008-09-24 13:15:26.272 [Shell] Initialised AES-256 SDCTR client->server encryption
. 2008-09-24 13:15:26.272 [Shell] Initialised HMAC-SHA1 client->server MAC algorithm
. 2008-09-24 13:15:26.272 [Shell] Initialised AES-256 SDCTR server->client encryption
. 2008-09-24 13:15:26.272 [Shell] Initialised HMAC-SHA1 server->client MAC algorithm
. 2008-09-24 13:15:26.413 [Shell] Reading private key file "C:\appid.txt"
! 2008-09-24 13:15:26.443 [Shell] Using username "bpd1mk".
. 2008-09-24 13:15:26.473 [Shell] Offered public key
. 2008-09-24 13:15:26.493 [Shell] Offer of public key accepted
! 2008-09-24 13:15:26.493 [Shell] Authenticating with public key "rsa-key-20061009"
. 2008-09-24 13:15:26.623 [Shell] Access granted
. 2008-09-24 13:15:26.643 [Shell] Opened channel for session
. 2008-09-24 13:15:26.793 [Shell] Started a shell/command
. 2008-09-24 13:15:26.793 [Shell] --------------------------------------------------------------------------
. 2008-09-24 13:15:26.793 [Shell] Using SCP protocol.
. 2008-09-24 13:15:26.793 [Shell] Doing startup conversation with host.
. 2008-09-24 13:15:26.793 [Shell] Skipping host startup message (if any).
> 2008-09-24 13:15:26.793 [Shell] echo "WinSCP: this is end-of-file:0"
! 2008-09-24 13:15:26.813 [Shell] /usr/local/sbin/namecheck.sh: test: argument expected
! 2008-09-24 13:15:26.843 [Shell] stty: : Invalid argument
! 2008-09-24 13:15:26.984 [Shell] stty: : Invalid argument
< 2008-09-24 13:15:27.164 [Shell] WinSCP: this is end-of-file:0
. 2008-09-24 13:15:27.164 [Shell] Detecting variable containing return code of last command.
. 2008-09-24 13:15:27.164 [Shell] Trying "$status".
> 2008-09-24 13:15:27.164 [Shell] echo "$status" ; echo "WinSCP: this is end-of-file:0"
< 2008-09-24 13:15:27.304 [Shell] WinSCP: this is end-of-file:0
. 2008-09-24 13:15:27.304 [Shell] Trying "$?".
> 2008-09-24 13:15:27.304 [Shell] echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2008-09-24 13:15:27.454 [Shell] 0
< 2008-09-24 13:15:27.454 [Shell] WinSCP: this is end-of-file:0
. 2008-09-24 13:15:27.454 [Shell] Return code variable "$?" selected.
. 2008-09-24 13:15:27.454 [Shell] Changing directory to "/tmp".
> 2008-09-24 13:15:27.454 [Shell] cd "/tmp" ; echo "WinSCP: this is end-of-file:$?"
< 2008-09-24 13:15:27.594 [Shell] WinSCP: this is end-of-file:0
. 2008-09-24 13:15:27.594 [Shell] Getting current directory name.
> 2008-09-24 13:15:27.594 [Shell] pwd ; echo "WinSCP: this is end-of-file:$?"
< 2008-09-24 13:15:27.735 [Shell] /tmp
< 2008-09-24 13:15:27.735 [Shell] WinSCP: this is end-of-file:0
. 2008-09-24 13:15:27.735 [Shell] Startup conversation with host finished.
. 2008-09-24 13:15:27.735 Executing user defined command on command session.
> 2008-09-24 13:15:27.735 [Shell] lls >lls.chk ; echo "WinSCP: this is end-of-file:$?"
! 2008-09-24 13:15:27.895 [Shell] ksh[6]: lls: not found
< 2008-09-24 13:15:28.085 [Shell] WinSCP: this is end-of-file:127
* 2008-09-24 13:15:28.085 (ETerminal) Command 'lls >lls.chk'
* 2008-09-24 13:15:28.085 failed with return code 127 and error message
* 2008-09-24 13:15:28.085 ksh[6]: lls: not found.
. 2008-09-24 13:15:28.085 Closing connection.
. 2008-09-24 13:15:28.085 Sending special code: 12
. 2008-09-24 13:15:28.085 Sent EOF message
. 2008-09-24 13:15:28.085 [Shell] Closing connection.
. 2008-09-24 13:15:28.085 [Shell] Sending special code: 12
. 2008-09-24 13:15:28.085 [Shell] Sent EOF message

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Command lls not working in script

1) You cannot redirect output of script command to file.
2) "call lls" executes the command in remote shell. There's obviously no lls command in your remote shell.

Reply with quote

Advertisement

You can post new topics in this forum