in my .bashrc I tried to setup some aliases.
is supposed to copy a local file to somehost via scp. However it seems that the command line substitution does not work here. However this works:
The above scp command can be handled like this which works for me:
I tried this on bash version:
GNU bash, version 3.2.39(1)-release (i386-redhat-linux-gnu)
I am curious why the first alias version doesn't work although the lst command seems to work well.
Thank you.
Say I write something like the following:
var1=1
var2=2
for int in 1 2
do
echo "\$var$int"
done
I want the output to be:
1
2
Instead I get something like:
$var1
$var2 (2 Replies)
Hi
I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/
Can anyone please help me on this? (3 Replies)
If one:
$ find -name 'some expression' -type f > newfile
and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory.
I am... (3 Replies)
Hi experts
I want to use the parameter substitution in the bash with ## to get
a=mfs1000 (not the "mfs" maybe other string and the length is not the same"
I want to get
1000
any help? I don't know use which pattern
I use
echo ${a##*}
It doesn't work
Lei (5 Replies)
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Hi:
there is a shell script, with the name "foo", located in a bin directory. in the same time, there is an alias "foo='/path/bin/foo' ", just for convenience.
in my home directory, there is a different script with name "foo" too. (a modified version.)
while in my home directory, when I... (3 Replies)
I want to do something like this:
alias cd2="cd /data_saves/$(/opt/bin/util/getcustdb -i $@)"
Where /opt/bin/util/getcustdb is an inhouse script to lookup customer db name based on a provided id number
Then when I use the alias I can
cd2 4567
and have it run "/opt/bin/util/getcustdb -i... (3 Replies)
Can I specify a default value to a variable in AWK like BASH in one statement using parameter substitution?
BASH example:
argument=${$1-"default if empty"} (BASH)
I know I can do:
argument=$1; sub ( "^$", "default if empty", argument) (AWK)
Mike (13 Replies)
I am trying add a prefix variable(string) to command output.
sed parameter substitution is not working.
- I have found some issues on my end of testing,, please delete this thread for now. (1 Reply)
I make alias in bashrc file and typed it on prompt,
alias tes='echo "$1"xx"$2"xxx"$3"xxxx'
$ tes a b c
xxxxxxxxx a b c
what's happened to the shell here ?, and also,
alias tes='echo "$3"xx"$2"xxx"$1"xxxx
$ tes a b c
xxxxxxxxx a b c
anyone sincerely is to help me.. (2 Replies)