1
그래서 두 개의 스크립트가 있습니다. mainscript.sh를 원격 로그인으로하고 attached.sh를 실행하지만 문제는 실행 결과 attach.sh에 설정된 옵션을 사용하지 않으면 간단히 옵션 목록에 반영됩니다. 나는 i/o 리디렉션과 관련하여 잘못된 것을 제공하고 있다고 생각합니다. 나는 이것에 초보 다. 그래서 어떤 도움이라도 대단히 감사하게되었다.쉘 스크립트가 원격 서버의 로컬 스크립트를 excecuting합니다
mainscript.sh
#!/bin/bash
echo "Please enter ther server name : "
read servername
ssh $servername "bash -s" < attached.sh
attached.sh
#!/bin/bash
OPTIONS="redhat Uptime logfile quit"
select opt in $OPTIONS; do
function redhat {
cat /etc/redhat-release
}
function Uptime {
uptime
}
function logfile {
cat /var/log/messages | less
}
function quit {
exit
}
if [ "$opt" = "redhat" ]; then
redhat
elif [ "$opt" = "Uptime" ]; then
uptime
elif [ "$opt" = "logfile" ]; then
logfile
elif [ "$opt" = "quit" ]; then
quit
else
clear
echo "bad option"
fi
done
은 로컬 또는 원격 서버에서'attached.sh '입니까? – Donovan
Attached.sh가 로컬 서버에 있습니다. – maxsis21