SET produces different results in a script?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers SET produces different results in a script?
# 1  
Old 03-29-2011
SET produces different results in a script?

Hi all,

So wondering if anyone has ever come across this...

I know if you run SET command you can see a listing of all your shell variables. HOWEVER, if you create a script in vi, and in that script you issue a set command, it does not return the variables when you run the file after making it executeable.

For instance...
user->set
variables would be displayed

but if you create a script named showme

vi showme
set

Now you run the showme file

showme
variables do not show

Anyone come across this or know how to get it to work properly?
# 2  
Old 03-29-2011
Try env
# 3  
Old 03-29-2011
Still doesnt work. Im using BASH. When I use env in the shell the variables do not appear and shen i use SET in the vi the variables do not appear.
# 4  
Old 03-29-2011
Strange. I just tried it on my system, which is:

BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="powerpc-apple-darwin7.0")
BASH_VERSION='2.05b.0(1)-release'

It works fine. What I did:

Code:
set

...all the info appears...

Then I created a script called "showset" with only one command (set) in it, made the script executable and then ran it.

Code:
chmod +x showset
./showset

And, voilá, it produces the same info like before.
# 5  
Old 03-29-2011
def not working for me. Guess ill try again tomorrow.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

2. Shell Programming and Scripting

Need a shell script to compare two directories and produces the output

Hi, I am using solaris OS 10 and Bash shell.I need a script which will compare the two directories and produces the output. Step 1: In detail say suppoose I have machine one and have a directory dir1. Script should iterate through the directories and subdirectories inside and produce the output... (10 Replies)
Discussion started by: muraliinfy04
10 Replies

3. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

4. Homework & Coursework Questions

2. Write a shell script that produces some summary information of the system at a particular moment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all... (2 Replies)
Discussion started by: jsk319342
2 Replies

5. UNIX for Dummies Questions & Answers

gzip produces different output from the same input

Hi there, I'm puzzled. Compressing the same file (same name, same md5sum) at two different times will produce a different output. I mean the md5sum of the resulting .gz files are different. Does it make any sens to any of you? I'd like some explanations if you know what's going on. Thanks... (4 Replies)
Discussion started by: chebarbudo
4 Replies

6. Shell Programming and Scripting

read -n1 -r -p "Press..." key / produces error in bash shell script

Hello! Sorry, for my not so perfect english! I want to stop bash shell script execution until any key is pressed. This line in a bash shell script read -n1 -r -p "Press any key to continue..." key produces this error When I run this from the command line usera@lynx:~$ read... (4 Replies)
Discussion started by: linuxinho
4 Replies

7. UNIX for Dummies Questions & Answers

Redirect produces zero byte file

I my shell script I call a program and redirect the output to a file. mypgm > myoutput.file Once in a while, the output file is zero byte. The programmer of mypgm said the program always produce some output. Is there any situation where a redirect will create a zero byte file even if the... (3 Replies)
Discussion started by: AIX_user
3 Replies

8. UNIX for Advanced & Expert Users

Set shell variables from SQLPLUS query results

Hi All, I needed to get the result of two sqlplus queris into shell variables. After days of looking for the ultimate solution to this problem.. i found this... sqlplus -s USER/PASS@DB <<EOF | awk '{if(NR==1) printf("%s ", $1); if(NR==2) printf("%s ", $1);}' | read VAR1 VAR2 set head off... (2 Replies)
Discussion started by: pranavagarwal
2 Replies

9. Shell Programming and Scripting

set -A RESULTS

Hi, Could you please tell me the meaning of the command set -A RESULTS '---echo sybase command to execute a tored porcedure ----------' | isql I just wants to know what does RESULTS contains after execution of command. Thanks Regards Ashish Malviya:) (2 Replies)
Discussion started by: Ashishm
2 Replies
Login or Register to Ask a Question