10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
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)
Discussion started by: abdulbadii
2 Replies
2. Shell Programming and Scripting
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)
Discussion started by: kchinnam
1 Replies
3. Shell Programming and Scripting
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)
Discussion started by: Michael Stora
13 Replies
4. UNIX for Dummies Questions & Answers
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)
Discussion started by: JourneyRider
3 Replies
5. UNIX for Dummies Questions & Answers
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)
Discussion started by: phil518
3 Replies
6. Shell Programming and Scripting
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)
Discussion started by: only4satish
5 Replies
7. Shell Programming and Scripting
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)
Discussion started by: yanglei_fage
5 Replies
8. UNIX for Dummies Questions & Answers
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)
Discussion started by: Alexander4444
3 Replies
9. Shell Programming and Scripting
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)
Discussion started by: pankaj80
3 Replies
10. Shell Programming and Scripting
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)
Discussion started by: Awanka
2 Replies