Home
Chess
English
Resume
Projects
Pictures
Assholes
Language
Artwork
Fileserv
Python
Poetry
LaTeX
Poker
Links
Bash
Exec
Web

Contact

11:38 am    04/24/24

     April 2024       
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 _2_4 25 26 27  
28 29 30              
                      
      
I use Bash (the bourne again shell). This is another page where I will keep things that I regularly forget about shell scripts in general (not just bash).
Here are two recent scripts I wrote recently that include a lot of the things that I tend to forget:
#!/bin/bash

if [ $# -lt 2 ] ; then
  PN=`basename "$0"`
  echo >&2 "usage: $PN  "
  exit 1
fi

echo "HELLO STUFF $1 $2"

#!/bin/bash

F=0.5879500E9

STEP=0.01

for((i=9; i<=18; i++)) ; do
  INPUT=`printf "fort.%d" $i`
  OUTPUT=`printf "out%d" $i`

  echo -e "$INPUT --process--> $OUTPUT         \c"

  rm $OUTPUT

  A=0.0
  while [[ `echo "$A < 0.5" | bc` -ne 0 ]] ; do
    OA=`printf "%4.2f" $A`
    echo -e "\b\b\b\b$OA\c"
    B1=`echo $A | cat - $INPUT | ./alibaba-5`
    B2=`echo $B1 | awk '{ print ($4 + $5) }'`
    B3=`echo $B1 | awk '{ print $7, $8 }'`
    B=`echo $B2 * $F | bc`
    echo "$OA $B $B3" >> $OUTPUT
    A=`echo $A + $STEP | bc`
  done
  echo -e "\b\b\b\bDONE"
done