10-16-2014
It is a really bad idea. It is extremely insecure, dangerous, error-prone(not just malfunctioning but syntax errors out of the blue given unexpected input), difficult to pass values into and out of, and incomprehensible to anyone who didn't write it (and often enough, to the writer, eventually).
Wanting to do so usually means more ordinary methods like functions, variables, and loops have been overlooked.
What exactly is your goal here? What problem are you trying to solve by storing commands?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all..
I got a problem..
Its easy to redirect o/p to a file.. But Is it possible to redirect the O/P to a variable?
For example:
I've a command in my script:
string1=cut -d ':' -f2 file.txt
When I do:
echo $string1
The value is empty... Pls suggest me how to store the value... (7 Replies)
Discussion started by: smartbuddy
7 Replies
2. Shell Programming and Scripting
I have a variable A
echo $A
5060
I am exporting the value X,Y,Z and it id fetching right thing and When I run
C=`${X} -l ${Y} ${Z} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; netstat -na | grep \$A`"
here it is going to same directory and also running netstat -na | grep 5060
... (4 Replies)
Discussion started by: madhusmita
4 Replies
3. Shell Programming and Scripting
Hi Jim,
The following script is in working state. But i m having one more problem with awk cmd. Could you tell me how to use any variable inside awk or how to take any variable value outside awk.
My problem is i want to maintain one property file in which i am declaring variable value into that... (12 Replies)
Discussion started by: Ganesh Khandare
12 Replies
4. Shell Programming and Scripting
I am sure it has been answered in some form or the other in this forum but trust me I have spent last couple of hours looking for an answer but can't find it.
I want to do a very simple operation within my script.
Let's say I have 4 files with the names file1.log, file2.log, file3.log and... (6 Replies)
Discussion started by: sssccc
6 Replies
5. Shell Programming and Scripting
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies
6. Shell Programming and Scripting
Hello Experts
I am newbie to unix and writing one script to make archive files
Problme i am facing is : I have used find command to find the type of files and I am storing find command results in a variable.
When I echo the variable I can see that path is printed properly but when i am... (5 Replies)
Discussion started by: mitsyjohn
5 Replies
7. Shell Programming and Scripting
Hi
How to use a variable to store the filename of a file which was found by the 'find' command.
can this be practical-->var = find . -name "filename.dat"
Please help.. (1 Reply)
Discussion started by: ayyappaas
1 Replies
8. Shell Programming and Scripting
Hello All
My req is to store the exit status of a command in shell variable
I want to check whether the file has header or not
The header will contain the string
DATA_ACQ_CYC_CNTL_ID
So I am running the command
head -1 $i | grep DATA_ACQ_CYC_CNTL_ID
Now I have to check if... (6 Replies)
Discussion started by: Pratik4891
6 Replies
9. Shell Programming and Scripting
I want to store the return value of
grep -c string filename
into a variable, say count. How do I do that?
For example if grep -c "string" "filename" shows 0 on executing it in the sh shell then I want to store this 0 in a variable. Is it possible? :D (5 Replies)
Discussion started by: navienavnav
5 Replies
10. Programming
I am trying to store output of python command in variable. Could you please help how I can do that ?
For example I am executing the following command - "CentOS" in server_desc
The output would be True or False
I would like to store the output in a variable say outPut and use condition... (4 Replies)
Discussion started by: atanubanerji
4 Replies
UPSRW(8) Network UPS Tools (NUT) UPSRW(8)
NAME
upsrw - UPS variable administration tool
SYNOPSIS
upsrw ups
upsrw -h
upsrw -s variable [-u username] [-p password] ups
DESCRIPTION
upsrw allows you to view and change the read/write variables inside your UPS. It sends commands via the server upsd(8) to your driver,
which configures the hardware for you.
The list of variables that allow you to change their values is based on the capabilities of your UPS equipment. Not all models support
this feature. Typically, cheaper hardware does not support any of them. Run upsrw with a UPS identifier to see what will work for you.
OPTIONS
-h Display the help message.
-s variable
Specify the variable to be changed inside the UPS. For unattended mode such as in shell scripts, use the format VAR=VALUE to spec-
ify both the variable and the value, for example:
-s HIGHXFER=129
Without this argument, upsrw will just display the list of the variables and their possible values.
Some variables are strings, and can be set to any value within the length limit. Others are enumerated types and can only be set to
one of those values. Refer to the list to know what's available in your hardware.
-u username
Set the username for the connection to the server. This is optional, and you will be prompted for this when using the -s option if
you don't specify -u on the command line.
-p password
Set the password to authenticate to the server. This is also optional like -u, and you will be prompted for it if necessary.
ups View or change the settings on this UPS. The format for this option is [upsname@]hostname[:port].
UNATTENDED MODE
If you run this program inside a shell script or similar to set variables, you will need to specify all of the information on the command
line. This means using -s VAR=VALUE, -u and -p. Otherwise it will put up a prompt and your program will hang.
This is not necessary when displaying the list, as the username and password are not required for read-only mode.
DIAGNOSTICS
upsrw can't set variables on your UPS unless you provide a valid username and password. If you get "access denied" errors, make sure that
your upsd.users(5) has an entry for you, and that the username you are using has permissions to SET variables.
HISTORY
This program used to be called upsct2, which was ambiguous and confusing.
SEE ALSO
upsd(8), upscmd(8)
Internet resources:
The NUT (Network UPS Tools) home page: http://www.exploits.org/nut/
NUT mailing list archives and information: http://lists.exploits.org/
Sat Aug 31 2002 UPSRW(8)