Define variables with UNIX script

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Define variables with UNIX script
# 1  
Old 11-02-2011
Define variables with UNIX script

oopps! I Meant "Define Variables within a UNIX Script"

What would be the best way to define a variable in a unix shell script so anyone who views this script doesn't know what value is assigned to that variable.

some other location...

Unix script...
sed s/input1/input2 <$a >newfileA

Last edited by macastor; 11-02-2011 at 04:04 PM..
# 2  
Old 11-02-2011
What are you trying to achieve ?
Are you trying to store a password because you want your script use this password to pass some other commands ?
# 3  
Old 11-02-2011
Trying to access a file that I would not want any other user to know where this file resides. Hope I make sense.... Smilie Basically I created a unix script to manipulate data in a text file that I don't want any other user that would happen to view this script know where this file is on my server.
# 4  
Old 11-02-2011
In that case why don't you use your environment then ? .[ceklp]* should not be readable to anyone else no? (Im thinking of custom variables in .profile or .kshrc and aliases...)
# 5  
Old 11-02-2011
It is more a permission issue than a scripting issue then ... i think you should clearly identify what are you needs in terms of access granting and then set the relevant chmod chown chroot and sudo stuff to achieve those restrictions instead of adding new lines of code to handle such kind of things.
# 6  
Old 11-02-2011
Gotcha! I was planning on changing the permissions to the unix script, just thought maybe I'd also have the location of this file defined as a variable in a private location. I'll try defining it in my .profile. Thanks guys!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need assistance to define path on a script which cron will execute

I have written a script to execute some sql statement via executable file. It is working fine via command line, however when I schedule it in cron. The executable file is looking for library file in its root directory. Wonder where does cron run the script from, and can we get the script... (4 Replies)
Discussion started by: jaapar
4 Replies

2. Shell Programming and Scripting

Define Variables

Hi, I just define the variable in script and use those script in another script but the variable not recognize. #!/bin/bash DB="test_db" USR="test_user" PWD="test_pwd" HST="" #!/bin/bash ./ mysql -u $USR -p $PWD -h $HST... (2 Replies)
Discussion started by: fspalero
2 Replies

3. Shell Programming and Scripting

How to define two digits variable in shell script?

Dear Shell script Experts, I am working on shell script which is defined here, qsub_seq.csh . The purpose of this script is to read few input files (with defined starting index and last index) and make processing faster over server. For some task, I had 1064 of input files, so I wrote another... (8 Replies)
Discussion started by: emily
8 Replies

4. Shell Programming and Scripting

Using a script to define variables and run multiple other scripts in succession.

I'm pretty new to scripting in Korn shell so please forgive me... What I'm trying to do is to create a script that calls multiple other ksh scripts and defines variables for text files. I need it to define my user defined variables (file paths, date & time stamps, etc that are currently in... (1 Reply)
Discussion started by: bluejwxn8
1 Replies

5. Shell Programming and Scripting

Using Datastage environment variables in Unix script

Hi All, I am using ETL tool Datastage and is installed on Linux environment. Few environment variables are set in datastage. Now my requirement is to use those environment variables in a unix script. Is there any option I can do it? Sugeestions from people working on datastage and linux... (1 Reply)
Discussion started by: bghosh
1 Replies

6. Shell Programming and Scripting

Loop to define variables in KSH

Hi, I am trying to use a database to store configurations in an environment definition scripts to make the configurations easily modifiable. (long story short - it is an easier process to make changes in the db than trying to deploy a file). The values will be stored in the database in the... (1 Reply)
Discussion started by: gbala
1 Replies

7. Shell Programming and Scripting

Simple unix variables in script

I'm creating a script that asks a user for a variable ex read filename; read numberinput; I also have a bunch of files named file.0 file.1 ... file.55 I'm trying to delete all files (if they exist) about file.$numberinput. Can someone help me out on how to include the variable as part... (6 Replies)
Discussion started by: jenix4545
6 Replies

8. Shell Programming and Scripting

Pass variables to a Unix script from a file

Hi, I am running a Java program from a unix script. I need to pass a variable to the Java code from a file. Here are teh details: cat Parm <<this is my Parameter file>> queuename=queue1 and my shell script is : #!/bin/ksh . ./Parm /opt/java1.5/bin/java -classpath ./java.jar... (1 Reply)
Discussion started by: sangharsh
1 Replies

9. Shell Programming and Scripting

Adding variables in a unix script

Hi I am trying to add variables(float values) in a unix script but am getting an error value=`expr $a + $b + $c` The error I am getting is "expr: non-numeric argument" I guess it has got to something with the decimal points. Plz help (13 Replies)
Discussion started by: akashtcs
13 Replies

10. UNIX for Dummies Questions & Answers

how to define permission of unix group

While logged on as root, I created a user 'usera' I also created a group called 'groupa' I need to modify the permission of the user i created to not have root privileges. I also need to change groupa to be in 'others' please help! thanks, nieves (3 Replies)
Discussion started by: mncapara
3 Replies
Login or Register to Ask a Question

Featured Tech Videos