Im trying to write a script that rsh's over to a unix machine and executes certain commands on certain files
SCRIPT SO FAR:
#!/bin/bash
#
MACHINE=uk01ff200
DIRECTORY=/var/core
rsh $MACHINE "cd /var/core"
for file in `ls -1 core.*`
do stack_dump $file
done
When I do this manually in the shell on the command line it works. So if I rsh over to the machine, cd to the directory, then type in the for loop it works (so I know the for loop syntax is correct). So I dont know where I'm going wrong with my script.
What I would do using a here-document :
#!/bin/bash
#
MACHINE=uk01ff200
DIRECTORY=/var/core
rsh $MACHINE bash <<'EOF'
cd /var/core
for file in core.*
do stack_dump "$file"
done
EOF
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.