I've learned never to parse ls

This commit is contained in:
Gandalf 2021-04-07 18:31:15 +02:00
parent 19279eefc3
commit 648fa1eb63
2 changed files with 2 additions and 1 deletions

View file

@ -29,6 +29,7 @@ Put
alias fax="/your/path/to/this/project/fax.sh" alias fax="/your/path/to/this/project/fax.sh"
alias faxstatus="/your/path/to/this/project/status.sh" alias faxstatus="/your/path/to/this/project/status.sh"
alias faxbalance="/your/path/to/this/project/balance.sh" alias faxbalance="/your/path/to/this/project/balance.sh"
# The following is obsolete, but for documentation/compatibility reasons:
fax-from-handle () { fax $1 "$(/your/path/to/this/project/Letterhead/Adressen/address.sh -f $2)"; } fax-from-handle () { fax $1 "$(/your/path/to/this/project/Letterhead/Adressen/address.sh -f $2)"; }
``` ```
into your `.bashrc` or `.bash_aliases` into your `.bashrc` or `.bash_aliases`

2
fax.sh
View file

@ -57,7 +57,7 @@ echo -n "Sending file ${FILE} "
REC=$(echo "$REC0" | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:') REC=$(echo "$REC0" | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:')
echo "to $REC" echo "to $REC"
#Checking for file size: #Checking for file size:
SIZE=$(ls -l $FILE | cut -d " " -f5) SIZE=$(stat -c%s "$FILE")
if [ $SIZE -gt 10485760 ] if [ $SIZE -gt 10485760 ]
then then
echo "File too big. Cannot be more than 10MB." echo "File too big. Cannot be more than 10MB."