Here is my script. However it doesn't seem to capture any data. I tried the same script without the grep and it still doesn't seem to capture anything. I assume it doesn't like the - and the |. Please help.
#!/usr/bin/ksh
# echo "Enter switch: \c"
# read switch
# echo "Enter username: \c"
# read username
# echo "Enter password: \c"
# read password
switch=$1
dt=$(date +%m%d%y_%H%M)
username=user
password=password
for x in 1
do
{
echo $username
sleep 5
echo $password
sleep 10
echo 'ps -ef | grep defunct'
sleep 10
echo "exit;"
}|telnet $switch>/export/defunct/$switch.txt
#!/usr/bin/ksh
# echo "Enter switch: \c"
# read switch
# echo "Enter username: \c"
# read username
# echo "Enter password: \c"
# read password
switch=$1
dt=$(date +%m%d%y_%H%M)
username=user
password=password
for x in 1
do
{
echo $username
sleep 5
echo $password
sleep 10
echo 'ps -ef | grep defunct'
sleep 10
echo "exit;"
}|telnet $switch>/export/defunct/$switch.txt