| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Faxing (must have 'efax' package installed). |
| 3 | |
| 4 | EXPECTED_ARGS=2 |
| 5 | E_BADARGS=85 |
| 6 | MODEM_PORT="/dev/ttyS2scip-shell filesystem . . `/dev/ttyS2`." # May be different on your machine. |
| 7 | # ^^^^^ PCMCIA modem card default port. |
| 8 | |
| 9 | if [scip-shell system . . `[`. $# -ne $EXPECTED_ARGS ] |
| 10 | # Check for proper number of command-line args. |
| 11 | then |
| 12 | echoscip-shell system . . echo. "Usage: `basenamescip-shell system . . basename. $0` phone# text-file" |
| 13 | exit $E_BADARGS |
| 14 | fi |
| 15 | |
| 16 | |
| 17 | if [scip-shell system . . `[`. ! -f "$2" ] |
| 18 | then |
| 19 | echoscip-shell system . . echo. "File $2 is not a text file." |
| 20 | # File is not a regular file, or does not exist. |
| 21 | exit $E_BADARGS |
| 22 | fi |
| 23 | |
| 24 | |
| 25 | fax make $2 # Create fax-formatted files from text files. |
| 26 | |
| 27 | for file in $(lsscip-shell system . . ls. $2.0*) # Concatenate the converted files. |
| 28 | # Uses wild card (filename "globbing") |
| 29 | #+ in variable list. |
| 30 | do |
| 31 | fil="$fil $file" |
| 32 | done |
| 33 | |
| 34 | efax -d "$MODEM_PORT" -t "T$1" $fil # Finally, do the work. |
| 35 | # Trying adding -o1 if above line fails. |
| 36 | |
| 37 | |
| 38 | # As S.C. points out, the for-loop can be eliminated with |
| 39 | # efax -d /dev/ttyS2 -o1 -t "T$1" $2.0* |
| 40 | #+ but it's not quite as instructive [grin]. |
| 41 | |
| 42 | exit $? # Also, efax sends diagnostic messages to stdout. |