Regarding changing shell thru script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regarding changing shell thru script
# 1  
Old 01-03-2009
Regarding changing shell thru script

Guys can I change the shell thru script, and after changing i want the script to continue on the previous machine.
Or please suggest other alternative if any???

#!/bin/ksh
HOST=`hostname`
echo "Running the script..."

for MyServer in `cat ServerNames.txt`
do
echo "\n Logging onto $MyServer"
ssh $MyServer -l Myname
ksh /tmp/Get_ParserInfo.ksh.ORG
echo " Script completed on $MyServer "
done
# 2  
Old 01-05-2009
This doesn't work. Are you trying to say that when you log into machine X you want shell XS, but if you log into machine Y you want shell XY? Is the password/login information common to both machines? Will the administrator let you make very simple changes to the configuration of either host?
# 3  
Old 01-06-2009
Quote:
Originally Posted by otheus
This doesn't work. Are you trying to say that when you log into machine X you want shell XS, but if you log into machine Y you want shell XY? Is the password/login information common to both machines? Will the administrator let you make very simple changes to the configuration of either host?

Thats the problem dude..... admin restrictions...
So what i did was...i used "here document" concept in the script

for MyServer in `cat ServerNames.txt`
do
echo "\n Logging onto $MyServer"
ssh $MyServer -l nyop <<EOT
ksh /tmp/Get_ParserInfo.ksh.ORG
EOT
echo " Script completed on $MyServer "

By this i was able to run the the script by logging onto other shell from my current shell
Hope dint confuse you!!!! Smilie
# 4  
Old 01-12-2009
I'm sorry I dropped the ball on this one...

Again, are you saying you want to use a different shell for interactive use? Or do you want to launch a program for each of the servers in ServerNames.txt ?
# 5  
Old 01-12-2009
The question here is , WHY you want to change the shell the script runs on? Maybe you mean "user" rather than "shell"?

Different shells have enough different syntax that could rend a script useless if run that script on a different shell it was written on. For example, a perfectly working ksh array will yield you errors on sh, csh, bash.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing shell from a script and running something from the new shell

Hi We use "tcsh" shell . We do the following steps manually: > exec ssh-agent zsh > python "heloo.py" (in the zsh shell) I am trying to do the steps above from a shell script This is what I have so far echo "Executing " exec ssh-agent zsh python "hello.py" exit 0 Problem is... (5 Replies)
Discussion started by: heman82
5 Replies

2. Shell Programming and Scripting

Help with shell script on Month Changing Logic

Hi Unix Experts, Happy Morning to all !! :) I am new to UNIX Shell Scripting and at my begineer level. To get acquainted to scripting, I am trying to create a script. The details/requirements of my script was to create a script with month changing logic in it so that on every 6th Working... (3 Replies)
Discussion started by: micky3112
3 Replies

3. AIX

AIX How to run a Shell Script by changing the User

Hi All, Currently our application is running on the server having AIX 5.3 OS. What we intend to do is to run a shell script owned by another user and needs to be run as that particular user. I was trying to create a shell script using the su command before running the actual script (which... (4 Replies)
Discussion started by: acoomer
4 Replies

4. Shell Programming and Scripting

shell script for changing two text files

HELLO I am new in shell bash script> I have two text files.They contain same datas. I want to change some text in two files.If I changed in one file.Then I want to change another same file without using vieditor.Iwant to change another file by using shell script for example file1 hello good... (7 Replies)
Discussion started by: vidhun.v
7 Replies

5. UNIX for Dummies Questions & Answers

Changing permissions in a shell script

Hi All, I have a shell script which we keep on changing permissions on a On-Demand Basis-->for e:g--from 400(Read only) to 740(Execute permission) etc. Is there any way by which I can view the history of the script?-->I am interested in finding out the date-time stamps when the script's... (2 Replies)
Discussion started by: DevotedPupil
2 Replies

6. Shell Programming and Scripting

Changing value of a variable inside a shell script

I have a continous polling happening inside a shell script on AIX. This actually calls a PL/SQL block. Is there a way I can set up a variable or pass an interrupt to end the script gracefully. I cant read from the config once the job starts running. Ideally I should change value of a variable and... (1 Reply)
Discussion started by: kshyju
1 Replies

7. Shell Programming and Scripting

How to run cmds after changing to a new env (shell) in a shell script

Hi, I am using HP-UNIX. I have a requirement as below I have to change env twice like: cadenv <env> cadenv <env> ccm start -d /dbpath ccm tar -xvf *.tar ccm rcv .... mv *.tar BACKUP but after I do the first cadenv <env> , I am unable to execute any of the later commands . ... (6 Replies)
Discussion started by: charlei
6 Replies

8. Shell Programming and Scripting

Changing cursor position using shell script

Hi, Pleae help me on this. Normally, when we say read username, the cursor will come in the first position of next line, but I want the output of the below Normal usage ------------- please enter username: _ I want like the below ---------------------- please enter username: ... (2 Replies)
Discussion started by: balamv
2 Replies

9. Shell Programming and Scripting

Password changing in a Script (shell and expect)

Hi, Does anybody know how to change the password on multiple servers with a script. I have 300 Sun boxes and the password expiry is set to 30 days. Im in a process to build a script using expect. Need a help from an expert who has already done it. Regards, Vinod (1 Reply)
Discussion started by: chellam
1 Replies

10. UNIX for Dummies Questions & Answers

Changing korn shell script text Menu colors?

Is it possible to change the color of text in a korn shell script Menu? I can change the color of session text through my telnet client but I want to be able to change color text in the Korn shell menu to highlight certain items. (6 Replies)
Discussion started by: darthur
6 Replies
Login or Register to Ask a Question