07-28-2009
"_" in variable names
Hello Experts,
I have written a UNIX shell which spans about 400 lines. I have tried to manage the flow as far as possible using functions. In the main shell flow, there are certain variables, not many really - around 10. These variables would obviously act as globals.
Here I need some advice - would it be a good thing to prefix these variables with an underscore "_" to have better readability? or am I just thinking of something unnecessary?
Regards,
HKansal
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to shell script. This is my first post .I have written a small script which returns list of names starts with "ram" in /etc/passwd .Here is that:-
#!/bin/ksh
NAME_LIST="name_list.txt"
cat /dev/null > $NAME_LIST
evalcmd="cat /etc/passwd | grep "^ram?*" | cut -d: -f1"
eval... (3 Replies)
Discussion started by: sachin.tendulka
3 Replies
2. UNIX for Dummies Questions & Answers
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
3. Shell Programming and Scripting
been a while so i'm a bit rusty and need a little help. writing a script that needs to compare $EXECHOST(a number) against a numerical range and then set a value. below isn't working but should give you folks an idea of my goal:
if ; then
echo "This is a 32B machine, exiting..."
if ;... (4 Replies)
Discussion started by: crimso
4 Replies
4. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
5. Shell Programming and Scripting
The "read" command, which is built into bash, takes words from the standard input. However, "read" is not good at taking file names if the file names contain spaces. I would like my bash script to ask the user to enter file names, which may contain spaces. Can you think about any technique for... (14 Replies)
Discussion started by: LessNux
14 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have a file, inputs.list that contain prefixes to files that are inputs for a program
inputs.list
A
B
C
D
E
...
My files are of the format A_1, A_2, B_1, B_2 and so on. I am planning to run a shell script that takes each line from the above file and feed it to the runProg.sh... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies
7. UNIX for Dummies Questions & Answers
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
8. Shell Programming and Scripting
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
9. AIX
Hi 2 all,
i have had AIX 7.2
:/# /usr/IBMAHS/bin/apachectl -v
Server version: Apache/2.4.12 (Unix)
Server built: May 25 2015 04:58:27
:/#:/# /usr/IBMAHS/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
... (3 Replies)
Discussion started by: penchev
3 Replies
LEARN ABOUT DEBIAN
envstore
ENVSTORE(1) BSD General Commands Manual ENVSTORE(1)
NAME
envstore -- save and restore environment variables
SYNOPSIS
envstore command [args ...]
DESCRIPTION
envstore can save and restore environment variables, thus transferring them between different shells.
command must be one of
clear
Forget all stored variables
eval
Produce shell code for evaluation, restoring all saved variables
list
List saved variables in better readable format
save variable [value]
Save variable either with its current shell value or with value
rm variable
Remove variable from store
Note: Only the first character of command is checked, so envstore e instead of envstore eval, envstore c for envstore clear, etc., are also
valid.
ENVIRONMENT
ENVSTORE_FILE The file in which the environment parameters are stored, /tmp/envstore-EUID by default,
LIMITATIONS
Variable names or values must not contain null bytes or newlines.
Due to limitations imposed by most shells, it is not possible to save parameters containing more than one consecutive whitespace. envstore
will save and display them correctly, but unless you do IFS trickery, your shell will not be able to load them.
The current maximum length (in bytes) is 255 bytes for the variable name and 1023 bytes for its content.
AUTHOR
envstore was written by Daniel Friesel <derf@derf.homelinux.org>.
Original idea and script by Maximilian Gass <mxey@ghosthacking.net>.
SEE ALSO
envify(1)
BSD
December 1, 2009 BSD