04-06-2005
You can't do stuff like: if [ $pnpanxx != $npanxx ] and [ $frange != T ]
Or at least it won't do what I'm guessing you think it might do. Try this:
if [ 1 = 1 ] and [ 99999 = 1 ] ; then
echo yes
fi
I don't understand how you can "kill the first loop process" and have it continue.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hello....very new user to unix...and i have a question..i am not sure if there is such a thing
For example...the user is asked if he likes Bananas....if he says yes....
echo You like Bananas $name
at the end of the script it echos all that the user has entered so they can read it....
but... (1 Reply)
Discussion started by: jonas27
1 Replies
2. UNIX for Dummies Questions & Answers
I'm trying to create a loop that will prompt the user for 15 values, not forcing them to enter all 15. If the user enters through one or more of the prompts the null value needs to be converted to 0, otherwise set the parameter = to the value entered:
ex.
Please enter file no #1: 17920
... (4 Replies)
Discussion started by: vdc
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
how can I use "for" to have two loops :
this is my script :
for i in (A B C)
do
for j in (a b c)
do
echo $i$j
done
done
#End
I want to print out
Aa
Ab
Ac ....
But I have error message :
syntax error at line 1 : `(' unexpected
Many thanks before.
How should I use "for" ?? (2 Replies)
Discussion started by: big123456
2 Replies
4. Shell Programming and Scripting
Hi
I've a file like so:
Now, I want to read my file and take ex. the Media ID and the Type for each groups of Media (Media1,Media2,...,Media(n):
cat /tmp/file|\
while read FILE
do
while $(FILE|cut -d: -f1)=Media$i
do
#here will be some test, ex:
#if Media ID < 23
... (4 Replies)
Discussion started by: nymus7
4 Replies
5. UNIX for Dummies Questions & Answers
I am traversing down a list, and I am not quite sure how to tell the loop to break when it's done going through the file.
#!/bin/sh
while :
do
read list <&3
echo $list
done
is the code. The file "list" is simply
5
4
3
2
1
any advice on how to break the loop after the file is... (1 Reply)
Discussion started by: MaestroRage
1 Replies
6. Shell Programming and Scripting
#!/bin/bash
IFS=$'\n'
A= a c b t g j i e d
B= t y u i o p
counter=0
found=""
for i in $(cat $A)
do
for j in $(cat $B)
do
if
then
found="yes"
fi
done
if
then (1 Reply)
Discussion started by: vadharah
1 Replies
7. Shell Programming and Scripting
Hi All,
I want to execute a script the number of times a user enters. Please can you advise on hor can I do the same.
Many Thanks,
Shazin (4 Replies)
Discussion started by: Shazin
4 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I'm not sure if this is more appropriate for the 'unix for dummies' or the 'unix for experts' forum because I'm new to this forum and this is the second topic I've discussed, but if you could let me know which one was more appropriate for something like this, please do!
So in tr (an... (2 Replies)
Discussion started by: juliette salexa
2 Replies
9. UNIX for Advanced & Expert Users
I'm trying to understand better the while and until loops, can someone help me with this example?
#!/bin/bash
# Listing the planets.
for planet in Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto
do
echo $planet # Each planet on a separate line.
done
echo; echo
for... (3 Replies)
Discussion started by: jose2802
3 Replies
10. UNIX for Dummies Questions & Answers
Why wont my for statements work? Im trying to get this script to swich to a user an if you put in a start/stop/or restart paramater to do just that for each user. I commented out the actual start/stop actions to test it just by using echos and not do anything hasty in the environment but it... (0 Replies)
Discussion started by: LilyClaro
0 Replies
LEARN ABOUT OPENSOLARIS
echo
echo(1B) SunOS/BSD Compatibility Package Commands echo(1B)
NAME
echo - echo arguments to standard output
SYNOPSIS
/usr/ucb/echo [-n] [argument]
DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output.
echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi-
ronment variables.
For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows:
o echo your current-working-directory's full pathname
o pipe the output through tr to translate the path's embedded slash-characters into space-characters
o pipe that output through wc -w for a count of the names in your path.
example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w"
See tr(1) and wc(1) for their functionality.
The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if
the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape
characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's
echo() also understands a as the audible bell character; however, these commands do not have an -n option.
OPTIONS
-n Do not add the NEWLINE to the output.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5)
NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases.
SunOS 5.11 3 Aug 1994 echo(1B)