You might also find it useful to check out useless use of backticks. Unlike perl, you can't cram things of unlimited size into a shell variable or argument list, so your programs might start surprising you once the file grows beyond 64KB (or even 4KB on some systems). This is an operating system limit.
Instead, whenever you have
you do
so you never need more than a line at a time stored in a variable. This also avoids creating an extra do-nothing process (cat).
You can even do token splitting with read like frans illustrated.
hi guys,
i have the following script and when i run it i get blank lines on the screen.. i am trying to display the contents of array var..
#!/usr/bin/bash
var=`awk 'NR>20&&NR<31' try.sum | awk '{print $4}'`
echo "${var}" (1 Reply)
set -A town_name india pakistan srilanka india
set -A town
m=0
n=0
while } ]
do
t1=`echo ${town_name}`
town= $t1
echo ${town}
n=$((n+1))
m=$((m+1))
done
t2=`echo ${town}`
echo $t2
i m trying to get the value of town array outside the loop but i m nt getting it..
Could u plz... (5 Replies)
NEWBIE ALERT!
Hi,
I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Hi All
I need to get <STDIN> from a user. the <STDIN> is a range of number delimited by "," (comma) and can be with range delimited by "-".
Example: 1,2,3,4-9,12,15,34-36,70
Now I need to get this from the user and go on each number and "Do something"... but when trying to do this as above... (2 Replies)
Hey everyone.
Is it possible to use two arrays in a loop?
Basically what I am trying to do is iterate through the elements in an array, and, based on a condition, use the current position in the array to point to that index in the array. Here's the loop structure I'm looking for:
... (1 Reply)
Hello ,
im sorry for my english .
im trying to create a dynamic menu that will display if the interface is ACTIVE OR STOPPED/FAILED
for some reason i cant get it to work properly
start_interface_func()
{
i=0
for interface_chk in 11 71 73 72 12 47 48 49 50 20 23 24 25 46 21 22 27 28... (5 Replies)
I have the following code and for some reason when I call the program using
/home/tcdata/tatsh/trunk/hstmy/bin/bash/raytrac.bash --cmod=jcdint.cmod
I get
hasArgument =
hasArgument = true
Somehow the array element is returning even though I have not chosen the option.
... (41 Replies)
I am fairly new to bash and am not sure how to resolve this:
I have a series of geographical long/lat points eg. 50/-30 listed on separate lines in a file called junk2. I have input these into an array and am then using that array in a for loop. Towards the end of the loop I create a file called... (4 Replies)
Hi All
I need really really help with this :-
I have two files ( File1 , File 2) both files are output of two different scripts.
File1 usually has a list of names ( sometimes 3 names sometimes 5 sometimes more , depends about the output of the script)
File2 usually has a list of numbers... (2 Replies)
Hi,
I'm trying to get the number of files inside same kind of folders on each disks and assigning each values in to a variable named with same folder and disk name so that it'll be easy for me to identify each time.But somehow I'm not able to assign those values in that specific name variable... (1 Reply)