I am sshed into another machine. Within that machine, I have a script called get_count.sh
#!/bin/sh
nzsql -u user -pw password -host hostname -port 1234 -db database -c "query"
run this script when I am sshed in and it works as expected. ./get_count.sh
I am using a python module paramiko
. This allows me to ssh in a machine and pass commands with python to the ssh session.
I am getting the output:
./get_count.sh: line 3: nzsql: command not found
I am connected to the same ssh session but I am not sure why this is occurring. Essentially these two processes are doing the same thing but I am not sure why doing the same thing is working one way and not working the other way
I tried changing the contents of my script to be something simple because I thought it could be due to paramiko
. So I replaced my nzsql
query with
echo 123
and it functioned properly.
My .bashrc
:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
my .bash_profile
:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
I did an echo $PATH
through paramiko and I get :
/usr/local/java/current/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin
Through logging in the terminal:
/usr/local/java/current/bin:/usr/lib/oracle/11.2/client64/bin:/app/netezza/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/bli1/bin