Menü +

find ./ -type f -name '*source-string*'

bash | control structures | loop – counter

BC_G=$(tput setb 7);FC_G=$(tput setf 2);FC_R=$(tput setf 4);FC_Y=$(tput setf 6);C_ESC=$(tput sgr0)

#----------------------------------------------------------------------
for i in 1 2 3 4 5
do
   echo "Welcome $i times"
done
#----------------------------------------------------------------------
for i in {1..5}
do
   echo "Welcome $i times"
done
#----------------------------------------------------------------------
echo "Bash version ${BASH_VERSION}..."
for i in {0..10..2}
  do
     echo "Welcome $i times"
 done
#----------------------------------------------------------------------
for i in $(seq 1 2 20)
do
   echo "Welcome $i times"
done
#----------------------------------------------------------------------
for (( c=1; c<=5; c++ ))
do
   echo "Welcome $c times"
done
#----------------------------------------------------------------------
for (( ; ; ))
do
   echo "infinite loops [ hit CTRL+C to stop]"
done
#----------------------------------------------------------------------
for I in 1 2 3 4 5
do
  statements1
  #Executed for all values of ''I'', up to a disaster-condition if any.
  statements2
     if (disaster-condition)
            then
	        break
                #Abandon the loop.
     fi
  statements3
  #While good and, no disaster-condition.
done
#----------------------------------------------------------------------
FILES="[email protected]"
for f in $FILES
do
        # if .bak backup file exists, read next file
	if [ -f ${f}.bak ]
	then
		echo "Skiping $f file..."
		continue  # read next file and skip cp command
	fi
        # we are hear means no backup file exists, just use cp command to copy file
	/bin/cp $f $f.bak
done
#----------------------------------------------------------------------

# ---
echo "${ORACLE_TABEL_SPACE}" | while read line;do echo -e "\t${FC_Y}$line${C_ESC}"; done

#----------------------------------------------------------------------

# ---
# To check if a directory exists in a shell script you can use the following:
if [ -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY exists.
fi
#
# Or to check if a directory doesn't exist:
#
if [ ! -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY doesn't exist.
fi
# ---------------------------------------------------------
# ---    : ksh, bash
#
counter=0
((counter++))
echo $counter
# ---------------------------------------------------------

# ---------------------------------------------------------
# ---    : proces monitioring whit - until loop
# ---    : nohup prozess remout starten und überwache.
#
test -f $HOME/putty_nohup_remout_start.out && rm $HOME/putty_nohup_remout_start.out
nohup sh $HOME/start.sh -uUser -pPass >$HOME/putty_nohup_remout_start.out 2>&1 &
until [[ "$(jobs -l | grep 'start.sh' | wc -l)" == "0" ]];do test "$(jobs -l | grep 'start.sh' | wc -l)" == "0" || echo "Das Script lauf noch $(jobs -l|column -t)";sleep 5;done
cat $HOME/putty_nohup_remout_start_start.out
#
#
test -f $HOME/nohup_start.out && rm $HOME/nohup_start.out
nohup sh $HOME/start.sh PERM01 1>$HOME/nohup_start.out 2>&1 &
#
echo -ne '\n[';until [[ "$(jobs -l | grep 'start.sh' | wc -l)" == "0" ]];do test "$(jobs -l | grep startallNM | wc -l)" == "0" || echo -n "===";sleep 1;done;echo -ne ']\n\n';
#
cat $HOME/nohup_start.out
read -rsp $'Press any key to continue...\n' -n1 key
#

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.