I'm trying to SSH from a mac osx machine to a solaris based machine and pass some commands but I'm not sure the best way to do it and am running into all sorts of issues using the different methods I've found online.  Right now the closest thing I have to working is:fraudcheck.sh#!/bin/sh#SUPNODE=10.0.97.17ssh -i /Users/jessebutryn/.ssh/Jesse_id_rsa root@$SUPNODE < /Users/jessebutryn/Documents/scripts/incomplete/fraudcommands.shfraudcommands.sh#!/bin/sh#source /root/toolbox/toolboxjbutrynfraud 1When I run these commands manually the output is as follows:joyentmac2252:~ jessebutryn$ ssh root@10.0.97.17[root@sup-jpc-west1 ~]# source /root/toolbox/toolboxEnter your JPC Headnode username: jbutrynToolbox - Version 4.4.6 - It's Wednesday, this must be Devon (20161116)---- Recent Changes ----Replaced sdc-ldap/ufds with OpenLDAP clientvm/vmi now shows SwapMoved creds to environmentAdded random element to disabler stringfraud() speed upAdded over() for PD overridesAdded RAM to vms_by_pkg / fraudAdded dates to cust()Big speed up for cust_vms(). You are welcome.------------------------[root@sup-jpc-west1 ~]# fraud 12017-06-29|2017-06-30DC      ALIAS         UUID                                  RAM    BILLING_ID                            OWNER                                 CREATEDsw_1    SRADB02PRJOY  f70b0642-020c-cd72-d644-e0453ccd0e56  65536  14bc8e86-d0f8-11e5-a148-b39af8e5cb7b  bc1e2a34-e6fd-c421-d362-aeccb09eb9a4  2017-06-30T20:29:36.853Z...However when I run the script it gives the following output:joyentmac2252:~ jessebutryn$ ~/Documents/scripts/incomplete/fraudcheck.shPseudo-terminal will not be allocated because stdin is not a terminal.Toolbox - Version 4.4.6 - It's Wednesday, this must be Devon (20161116)---- Recent Changes ----Replaced sdc-ldap/ufds with OpenLDAP clientvm/vmi now shows SwapMoved creds to environmentAdded random element to disabler stringfraud() speed upAdded over() for PD overridesAdded RAM to vms_by_pkg / fraudAdded dates to cust()Big speed up for cust_vms(). You are welcome.------------------------/root/toolbox/toolbox: line 1888: [: =: unary operator expected2017-06-29|2017-06-30DC  ALIAS  UUID  RAM  BILLING_ID  OWNER  CREATEDBelow is line 1888 in the toolbox script and I'm not even sure what it's purpose is but I know I don't match that user:[root@sup-jpc-west1 ~]# sed '1888!d' sup-toolbox/toolboxif [ $(who am i | /usr/bin/cut -d' ' -f 1) = pgale ]; thenI've tried all sorts of solutions for passing the commands through including:echo jbutryn | ssh -i ...ssh -i ... jbutrynfraud 1I've tried to echo and read the commands in the fraudcommands script.  I'm fairly new to all of this so any help is appreciated.  Thanks!
Issues passing commands to another script through ssh
ssh;solaris
You are getting the [: =: unary operator expected error because the who am i command on the left side $(who am i | ...) is not returning any text, so therefore you should always put such fields/variables/etc. in quotes.  The reason who am i is returning no text, is because it gives you the information about the terminal (which only exists if you run it manually). Unfortunately ssh is not starting a real/full terminal session if you running a command (so called non-interactive session).  You should try replacing it with e.g. $USER, which is even more efficient (variable access is way faster than starting a new program):if [ $USER = pgale ]; thenAs a workaround you could run it with ssh -t <script>, which will allocate a pseudo-terminal, making who am i work again.