04-09-2009
try declaring the array outside the while loop
and for double substitution, use eval statement
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I want to substitute variable in sed using combination of name and var_$name:
name=Tom
var_$name=1
sed -n "${var_"$name"}"p < myfile
but it doesn't work, do you know what's wrong ?
Thanks (1 Reply)
Discussion started by: asal_email2
1 Replies
2. Shell Programming and Scripting
Hi
I have a variable whose value is like this
i=/test/test1/test2/myfile.cd.070505123457
i would like to have the value of myfile.cd stored into another variable
my attempt is
test=${i##*/} ;echo $test ##and i get
myfile.cd.070505123457
since what i wnat is myfile.cd i try this... (19 Replies)
Discussion started by: xiamin
19 Replies
3. Shell Programming and Scripting
Hello,
I would like to dual subtitutes variables.
I tried
$serv="combo"
combo_TYPE="mop"
TYPENAME="$serv_TYPE"
Now, I'd like to get "mop" from TYPENAME
echo "${${TYPENAME}}"
I have a bad substitution error
:) (1 Reply)
Discussion started by: pppswing
1 Replies
4. Shell Programming and Scripting
Is it possible with a bash variable to perform multiple substitution strings to one variable?
I have this variable:
echo $clock
TIMEZONE="US/Central"
What I would like to do with bash only it pull out just the "US" part of the variable.. which could be any number of countries.
this is... (6 Replies)
Discussion started by: trey85stang
6 Replies
5. Shell Programming and Scripting
Hi,
I am generating html code using cshell, but i am having one problem while printing double quotes,
I need to write following code in file. where $var contains list of web address
<a href="$var">$var</a>
So i am using
echo "<a href="$var">$var</a>" > file.html
But with this " in... (4 Replies)
Discussion started by: sarbjit
4 Replies
6. Shell Programming and Scripting
Hello!
I'm writing a shell script using #!/bin/bash instead of #!/bin/sh because of the substitution: ${!variable}, which won't work with sh. My main problem is the following (just a summarized example, the script is much more complex):
# sourced from a configuration file, we have a lot of... (6 Replies)
Discussion started by: teresaejunior
6 Replies
7. Shell Programming and Scripting
I have one script calling another with a set of strings that includes white space. Script A calls Script B with these input strings: one two "th ree"
Script B pulls apart the arguments correctly:
arg0 = one, arg1 = two, arg2 = "th ree"
if I call it from within Script A like so:... (10 Replies)
Discussion started by: skippyV
10 Replies
8. UNIX for Dummies Questions & Answers
$ ABCel='abc@gmail.com'
$ XYZel='xyz@gmail.com'
$ MYel='my@yahoo.com'
$ echo $ABCel
abc@gmail.com
$ echo $XYZel
xyz@gmail.com
$ echo $MYel
my@yahoo.com
I tried 3 variations, but not getting the expected result:
$ for VAR in ABC XYZ; do echo -e "${VAR}el $MYel"; done
ABCel... (1 Reply)
Discussion started by: bagnoble
1 Replies
9. Shell Programming and Scripting
OK, I'm striving to abide by all the rules this time.
Here is a fragment of my windows10/cygwin64/bash script:
export BUPLOG=$(BackupRecords --log "$src")
robocopy $(BackupRecords -mrbd "$src" --path "$src") $(BackupRecords --appSwitches "$src") "$src" "$dst" $(BackupRecords --fileSwitches... (0 Replies)
Discussion started by: siegfried
0 Replies
10. Shell Programming and Scripting
Hi all,
I have a moderate size (300 lines) BASH Shell script that performs various tasks on different source reports (CSV files). One of the tasks that it performs, is to use SED to replace 'non-conforming' titles with conformant ones. For example "How to format a RAW Report" needs to become... (3 Replies)
Discussion started by: richardsantink
3 Replies
RBASH(1) General Commands Manual RBASH(1)
NAME
rbash - restricted bash, see bash(1)
RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is
used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow-
ing are disallowed or not performed:
o changing directories with cd
o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
o specifying command names containing /
o specifying a file name containing a / as an argument to the . builtin command
o specifying a filename containing a slash as an argument to the -p option to the hash builtin command
o importing function definitions from the shell environment at startup
o parsing the value of SHELLOPTS from the shell environment at startup
o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
o using the exec builtin command to replace the shell with another command
o adding or deleting builtin commands with the -f and -d options to the enable builtin command
o using the enable builtin command to enable disabled shell builtins
o specifying the -p option to the command builtin command
o turning off restricted mode with set +r or set +o restricted.
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script.
SEE ALSO
bash(1)
GNU Bash-4.0 2004 Apr 20 RBASH(1)