I'm trying to make changes in a file using the following bash script:
#!/bin/bash
MYHOME=`echo $HOME`
README=$MYHOME"/environment"
IAM=`whoami`
CHANGEPATHLIST="TALOG TACONFIG TAINFO TAWORK TMPSPACE"
for var in $CHANGEPATHLIST
do
perl -pi -e 's/sacuser1/$IAM/ if m/$var/' $README... (3 Replies)
Hi,
I have a text file in which , I have contents like
t1=abc
t2=xyz
t3=awe
......
I am able to read contents of these variables in a script by
. /temp.txt
echo $t1
Now, what my requirement is something like this
a="t"
i=1
echo $a$i --->this is displaying t1 (3 Replies)
1) I've added a variable called IMPORT_HOME to my ~/.bashrc file:
IMPORT_HOME=/import:$IMPORT_HOME
2) I sourced the bashrc file:
source ~/.bashrc
3) In my bash script, i tried to echo out the IMPORT_HOME variable but it doesnt print out '/import/, only whitespace:
#!/bin/bash
echo... (2 Replies)
Hi,
I have a file (details.txt) with 3 rows of variables ie...
name postcode age
john D fr25dd 25
mark W ab122aa 22
phil C cd343bb 33
What I want to do is read down the list with a loop and add each field into a one line piece of text...
So I have a file (test1) which reads;... (3 Replies)
Hi,
Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- ---------... (5 Replies)
Im trying to set a filename to a variable and then read the file in using the variable but im getting a syntax error. any ideas?
#!/bin/bash
function scanFile()
{
while read $1
do
echo $filename
done
}
file1=report.log
scanFile() $file1 (3 Replies)
Hi,
I have a situation where I need to read a variable from another file. But the problem is that the variable in the other file is starting with $.
E.g.
file1:
$var1=out
temp_ss.sh:
. file1
echo "Print : $var1"
It works fine if the file1 is having var1=out (note that it is... (6 Replies)
Hello,
I need to read a variable value from script.
Below is the scenario
I am reading a value from an external file say a.txt
a.txt:
Jan
Feb
Mar
I need the corresponding value of the months in in numerics such as Jan -->1,
Feb-->2 etc.
I have this mapping in another file... (1 Reply)
I have a simple script that sets a value and reads the value in csh:
set -x
set a = 10
echo $a
The output of the script does not show the value of a
+ set a = 10
+ echo
any help would be great. (4 Replies)
hi all,
i create 1 file.txt and inside it contain :
file1
file2
file3
file 4
then output that i want in my script:
$1=file1
$2=file2
$3=file3
$4=file4
but,when write in ksh script with:
while read folder
set - $( echo ${folder} )
i=1
while (($i <= $#))
do
... (2 Replies)