Need to understand a couple of Shell Logic


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to understand a couple of Shell Logic
# 1  
Old 05-10-2013
Need to understand a couple of Shell Logic

Hi,

I am trying what the following loop does :

Code:
for i in XYZ
do
	for j in M1 R1 R2 R3
	do
		if [ $j == "M1" ]
		then
			kList=""
			n=1
			while [ $n -le $num_m ]
			do
			 	kList="$kList $n"
			   	let n++
			done

There are a couple of loop as mentioned above for R1.R2.R3.

Also, would like to know what does following line means :

[ $# -lt 18 ]] && usage

JPrince
# 2  
Old 05-10-2013
To understand for loop refer: Bash For Loop

To understand $# refer: Special Shell Variables
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Answers to Frequently Asked Questions

Not able understand logic and working

not understand (1 Reply)
Discussion started by: scriptor
1 Replies

2. Shell Programming and Scripting

Need help to understand the below shell script

Please help me to understand the below 3 lines of code.execute shell in jenkins 1)APP_IP=$( docker inspect --format '{{ .NetworkSettings.Networks.'"$DOCKER_NETWORK_NAME"'.IPAddress }}' ${PROJECT_NAME_KEY}"-CI" ) 2)HOST_WORKSPACE=$(echo ${WORKSPACE} | sed... (1 Reply)
Discussion started by: naresh85
1 Replies

3. UNIX for Dummies Questions & Answers

Help with understand shell script coding

Good afternoon everyone, I am very new to UNIX shell scripting and I am trying to understand the following code. I know what it does but I need to modify it so it will allow me to pass a file name as *FILENAME* Thank for any guidance offered. if ] ; then match=`expr "$file" :... (2 Replies)
Discussion started by: Walter Barona
2 Replies

4. UNIX for Dummies Questions & Answers

Need to understand shell script

Hello, Can someone please help me understand the shell script below for installing Jboss EAP 6? It is from jboss-as-standalone.sh, what does the highlighted code mean? # Load Java configuration. && . /etc/java/java.conf export JAVA_HOME Thanks! (4 Replies)
Discussion started by: learnix
4 Replies

5. Shell Programming and Scripting

Shell script using expect to login to couple of remote servers and read "crontab -l"

I need a shell script using expect to login to couple of remote servers and read "crontab -l -u <username>" & "cat /etc/rc.local" & "df -h" and able to create output into a file saved locally with hostname.crontab & hostname.rc.local & disk.status. I can supply a file as list of hostname or IP... (4 Replies)
Discussion started by: jaipsharma
4 Replies

6. Shell Programming and Scripting

Difficulty with a couple commands porting from korn shell to bash

I am relatively new to shell scripting. I have a script I wrote that works fine in korn shell. I need to make it work in bash on a different server. There are a couple valid korn shell commands I am having difficulty finding the bash equivalents for. At one point the scripts prompts the... (5 Replies)
Discussion started by: inakajin
5 Replies

7. Shell Programming and Scripting

Understand a old unix shell script

Hi All, I have a unix old script i but i am not able to understand the few commands in it and what it does. below is the script. if ; then for F in $(find $DIR/. ! -name . -prune -name "DP_*.dat") do IN=${F##/*/} OUT='ORD'$(echo $IN | cut -c7-) exec.ksh $IN... (2 Replies)
Discussion started by: kam786sim
2 Replies

8. Shell Programming and Scripting

I need to understand the differences between the bash shell and the Bourne shell

I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done. I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and... (7 Replies)
Discussion started by: awk_sed_hello
7 Replies
Login or Register to Ask a Question