ksh script to execute 2 variabless in universe enviroment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh script to execute 2 variabless in universe enviroment
# 1  
Old 09-22-2014
Display ksh script to execute 2 variabless in universe enviroment

Hello, Im trying to write a ksh script that will enter the universe environment as user kourier (switching to this specific user automatically launches to the TCL prompt). At the TCL " > " prompt i want to execute two variables. However, it wont recognize the second variable (user input Answer) due to the space in between the two variables. Please help Smilie

Code:
#!/bin/ksh

printf "Enter Account name: "
read Answer

SWITCHACCOUNT="LOGTO" 

su - kourier $SWITCHACCOUNT $Answer

script output and error:
Code:
Enter Account name: ARENA
Account "" is not set up for uniVerse.

# 2  
Old 09-22-2014
Hello seekryts15,

Assuming that the LOGTO command/script is expecting to have a parameter supplied, I would guess that it might be in the parsing so double quotes may help. I'd maybe change it to use the -c flag of su too.

Pop a set -x in before it too to show you what it's trying to do. Obviously take that out when you want to use it properly.
Code:
#!/bin/ksh

printf "Enter Account name: "
read Answer

SWITCHACCOUNT="LOGTO" 

set -x
su - kourier -c "$SWITCHACCOUNT $Answer"

If it still doesn't work, post the output and I/we will have another think.


Kind regards,
Robin
# 3  
Old 09-22-2014
Hi Robin,
Thanks for the quick reply. I have applied the changes but since the user "kourier" shell is set to launch in universe it sees "-c" as a command entry. Any ideas would be appreciated, thanks

Error:
Code:
Enter Account name: ARENA
+ su - kourier -c LOGTO ARENA
Verb ".C" is not in your VOC.

# 4  
Old 09-22-2014
Maybe I'm getting mixed up with remote shell. Try dropping the -c

I'm not sure what "Universe" is. Does this account have a changed default shell or something in the auto-profile (depends which shell)
Code:
grep kourier /etc/passwd

# 5  
Old 09-22-2014
It doesn't like the "set -x"

Code:
+ su - kourier LOGTO ARENA
Account "" is not set up for uniVerse.

I went ahead and removed that as well. As a test on a single variable it works fine. Only when I try to introduce two variables.

Single variable tested good:

Code:
ACCOUNTCHK="WHO"

su - kourier $ACCOUNTCHK

OUTPUT:
Code:
Enter Account name: ARENA
12 KOURIER From kourier

---------- Post updated at 04:52 AM ---------- Previous update was at 04:50 AM ----------

I just dont know how to get it to recognize the space in between the two variables so it can execute the entire line.

---------- Post updated at 04:55 AM ---------- Previous update was at 04:52 AM ----------

the default shell for kourier is:

shell=/uv/bin/uv
# 6  
Old 09-22-2014
I regret that I'm stuck then. I have no familiarity with Universe. Is it purchased software?



Robin
# 7  
Old 09-22-2014
its a project I'm working on for my job :/
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute a shell script in UNIX m/c from win 7 using ksh

I need to run a shell script on unix machine from windows 7. I used the "RSH" command in win XP successfully for this, But on win 7 it is not working. Can any body tell me how to run RSH on win 7 or any other command for similar use. I use the command as below rsh <unix m/c> -l <username>... (1 Reply)
Discussion started by: arup1980
1 Replies

2. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

3. Shell Programming and Scripting

KSH Script to Execute command from specific column in file

Hi Unix Experts,Team I have a file (say comand_file.prm), The file has a command specified in column 6 (say "./execute_script.sh"). I want to execute this command in my script. I am writing a KSH script to achieve this. Could you please assist me with this. (6 Replies)
Discussion started by: Jeevanm
6 Replies

4. Windows & DOS: Issues & Discussions

Windows remote to Solaris to execute ksh script

Hi all, I'm not sure if it is correct to post here. I am facing problem wanting to create a batch that run from my Windows XP pc to remote to multiple Solaris server to execute the server's ksh script. :wall: Can anyone give me a hints on how to do that? Thanks. (6 Replies)
Discussion started by: beginningDBA
6 Replies

5. Shell Programming and Scripting

How can I execute another shell from my ksh script?

I am newbie in UNIX, so please excuse me for the stupid question.:) Here is a problem: I created ksh script where the part of the functionality include an opening of a second session with another shell process "runrep"(runrep is a custom reporting shell designed by Advent Geneva). When I run my... (3 Replies)
Discussion started by: alexstar
3 Replies

6. Shell Programming and Scripting

Time taken to execute a ksh

Hi, I am executing a ksh. I want to note the time taken to execute each command that are executed in the ksh and write it in a log file. Also I want to note the total time taken to execute the ksh. How can I do that?What is the command to do that? (2 Replies)
Discussion started by: Kishore_1
2 Replies

7. Shell Programming and Scripting

How to pass enviroment variable from csh to Informix sql script

Hello, I have a csh script that creates an environment variable. I want to pass the environment variable(CURR_TABLE_DATE) to an Informix sql script. Here is the csh: #!/bin/csh -f setenv INFORMIXSERVER market3_tcp setenv CURR_TABLE_DATE 20090714 set DATABASE = gm_cdr set SQL_DIR =... (0 Replies)
Discussion started by: jwoj
0 Replies

8. Shell Programming and Scripting

execute a ksh script from perl script!

Hi, I have used exec ("/bin/ksh -c /path/file.ksh arg1"); to execute the file.ksh script from a test.pl script. But it doesnt work.. can anyone tell me what exactly the systax should be?... i have tried system("/path/file.ksh arg1"); too....still no luck... quick replies are highly appreciated (1 Reply)
Discussion started by: meghana
1 Replies

9. Shell Programming and Scripting

Enviroment Differences script(s)

Im looking for any sample scripts that would output a current environment setup to a file and possibly then take 2 files and list any differences This will allow us to quickly see any differences between environments in case of issue? At a high level this would take Unix Kernel Params,... (2 Replies)
Discussion started by: JoeShmoe
2 Replies
Login or Register to Ask a Question