Then error while running script remotely


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Then error while running script remotely
# 1  
Old 08-08-2013
Then error while running script remotely

facing issue with then error while running a local script aginst a remote server. i facing the same issue in multiple scripts. So what i am missing here or what is needed.

Code:
#!/bin/ksh
echo "enter the filename"
read file
if [ -f "$file" ]
then
echo "file exists"
else
echo "file does not exists"
fi

running locally works fine, but remotely showing `then' is not expected.

i'm running like this
Code:
ssh username@hostname ksh -s < scriptname


Last edited by Scott; 08-08-2013 at 07:36 AM.. Reason: Double post. Closed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Running local script remotely with arguments

Dear Experts, I have found this script on internet that can be used to execute local script remotely #!/bin/bash # runremote.sh # usage: runremote.sh localscript remoteuser remotehost arg1 arg2 ... realscript=$1 user=$2 host=$3 shift 3 # escape the arguments declare -a args ... (4 Replies)
Discussion started by: mukulverma2408
4 Replies

2. Shell Programming and Scripting

[bash] running a function remotely using ssh

Hi all. I need a bash script to run a function remotely. I think it should be similar to the following but can't figure out the exact syntax. Here is the script: #!/bin/bash function nu () { for var in {0..5}; do printf "$var, "; done; echo } ssh host "$(typeset -f); nu" ... (9 Replies)
Discussion started by: ziguy
9 Replies

3. Shell Programming and Scripting

Difference between running a script locally and remotely

Hello, Please, what is the difference between running a script remotely: ssh -t root@$machine -x "sshpass -p 'ubuntu' ssh -t ubuntu@$address -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul -x './c-launch.sh'" and running a script directly on the host: ... (1 Reply)
Discussion started by: chercheur111
1 Replies

4. Shell Programming and Scripting

Running local script remotely with arguments in ksh

When i use ssh command to execute local script on remote server , I am unable to do it. Please let me know how this can be done in ksh req=abc dte=ghd ssh username@hostname "$req $dte" < run_script.sh (2 Replies)
Discussion started by: lalitpct
2 Replies

5. Solaris

Can i bind to a local login terminal running using rsh or remotely

Hi Can i ask? I had multiple solaris workstation running and some local users using it. Is it possible to bind to the local user terminal or console he's using as if like the user well type and I can see it and what my typing in the local user see it also. Is it possible.. Thanks. (3 Replies)
Discussion started by: jao_madn
3 Replies

6. AIX

Mozilla running remotely

We have a server that has CDE and Mozilla installed on it. I have a develpoer who want to have an application start Mozilla locally on the AIX server (which has no video card) or wants Mozilla running on the server at all times. Can anybody tell me if this is at all possible? If so how and if... (4 Replies)
Discussion started by: daveisme
4 Replies

7. Shell Programming and Scripting

running command remotely to populate local variable

If I run this # ssh remote-server 'du -sk /usr/platform/`uname -i`/' 174 /usr/platform/SUNW,Sun-Fire-V245 I get my output just fine, However, if i try to do the same but populate a local variable within my script called for example 'result' #!/bin/ksh result=`ssh remote-server... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

8. Shell Programming and Scripting

error in in running script

Hi all, I have created a script file .sh and had some allias commands, local variable, some grep features, and listing files/directories, and it worked correctly and I got the outputs I am looking for after I run the script . However, some of the grep commands and some other functions did not... (2 Replies)
Discussion started by: aama100
2 Replies

9. Shell Programming and Scripting

Running an Interactive Program Remotely

now, i have a program that i would very much prefer to run remotely as i hate having to log into the box it is on. the problem is, every command i have tried to run this remotely doesn't work. the commands tries to kick off the program on the remote box but then hangs. like take for... (3 Replies)
Discussion started by: Terrible
3 Replies

10. Shell Programming and Scripting

running commands with remotely with Telnet

i have a box here that can only be accessed with telnet. now, i was wondering if anyone know of a way of which i can run a command on that box remotely. (2 Replies)
Discussion started by: Terrible
2 Replies
Login or Register to Ask a Question