Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 2
    You are using double quoted strings within double quoted strings (see "$?" and the other things that you quote within the command you execute with ssh). Commented Feb 8, 2019 at 7:34
  • I removed "" from $? but still same output. + for b in 'cat /home/sandeepj/Project_finduser01/userslist' + userid=raj.singh + echo -e '\n' + echo -n raj.singh + ssh -t [email protected] 'grep raj.singh /etc/passwd > /dev/null; if [ 0 = 0 ]; then echo -n ' : User 'exsits > /tmp/status else echo -n ' : User not 'exsits > /tmp/status fi' Commented Feb 8, 2019 at 7:40
  • 2
    I this really your script? If you run what you show, you will get syntax errors because of the wrong quotes. You need a closing " on the grep line, and you have an extra " on the final fi line. Look at the syntax highlighting (colors) in your question. Please edit and fix it so you show the exact script you are running. Commented Feb 8, 2019 at 10:34
  • @terdon - Script is working fine and i am using same " " to pass my multiple command with ssh.it will be very help full if you guide me any idea or alternate about this code. I am beginner in Shell Scripting track. Commented Feb 8, 2019 at 11:54
  • 1
    @SandeepSingh if the script is working, then you are not running the script you have in your question. Please correct the issues I mentioned in my comment. Commented Feb 8, 2019 at 12:01