Skip to content

Commit

Permalink
eepflash.sh: Accept filename as separate parameter
Browse files Browse the repository at this point in the history
Shell expansion of ~ to $HOME (e.g. ~/filename), and TAB completion
on the command line, doesn't work in the middle of a string. Accept
-f filename and --file filename in addition to the usual -f=filename
and --file=filename as a way around this problem.

See: raspberrypi/hats#76

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  • Loading branch information
pelwell committed Jun 22, 2021
1 parent 39ed725 commit b008bb6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eepromutils/eepflash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ usage()
echo " -r --read: read .eep from the EEPROM"
echo " -w --write: write .eep to the EEPROM"
echo " -f=file_name --file=file_name: binary .eep file to read to/from"
echo " N.B. -f file_name and --file file_name (without =) also accepted"
echo " -d= --device= i2c bus number (ex if the eeprom is on i2c-0 set -d=0)"
echo " -a= --address= i2c EEPROM address"
echo " -t=eeprom_type --type=eeprom_type: EEPROM type to use"
Expand All @@ -30,7 +31,7 @@ usage()
echo ""
echo "Example:"
echo "$me -w -f=crex0.1.eep -t=24c32 -d=1 -a=57"
echo "$me -r -f=dump.eep -t=24c32 -d=1 -a=57"
echo "$me -r -f dump.eep -t=24c32 -d=1 -a=57"
echo ""
}

Expand Down Expand Up @@ -70,6 +71,10 @@ while [ "$1" != "" ]; do
;;
-f | --file)
FILE=$VALUE
if [ "$1" = "-f" -o "$1" = "--file" ]; then
shift
FILE=$1
fi
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
Expand Down

0 comments on commit b008bb6

Please sign in to comment.