home bbs files messages ]

Just a sample of the Echomail archive

<< oldest | < older | list | newer > | newest >> ]

 Message 603 
 Deon George to Alan Ianson 
 My bash script 
 04 Aug 19 12:23:50 
 
TZUTC: 1000
MSGID: 26.fdn_tuxpower@3:633/509 21ab77d0
REPLY: 1:153/757.0 7cba21f5
PID: Synchronet 3.17c-Linux  Jul 25 2019 GCC 6.3.0
TID: SBBSecho 3.07-Linux r3.119 Jul 25 2019 GCC 6.3.0
COLS: 80
  Re: My bash script
  By: Alan Ianson to All on Sat Aug 03 2019 12:13 pm

 > Hello All,
 > I am using this in a bash script to toss incoming files here and am having a
 > problem with it that I hope someone can shed some light on for me.

 > if [ -f fido/inbound/*.tic ]; then

 > there in just one inbound *.tic but if there are more than one tic to be
 > processed it fails and I see this..

Yeah, the reason it would fail, is the shell will expand it. IE: If you have 2
TIC's "a.tic", "b.tic", the command expands to:

: if [ -f fido/inbound/a.tic fido/inbound/b.tic ]; then

Which is a syntax error. There are probably many ways to do this, the way I
would do it is:

MOVED=0
for i in fido/inbound/*.tic; do
  # If there are no files $i will equal "fido/inbound/*.tic"
  if [ "$i" == "fido/inbound/*.tic" ]; then continue; fi

  mv $i $destination;
  MOVED=1
done

if [ ${MOVED} -eq 1 ]; then
...
fi

 > One last question.. I have a second section like the aboveeeee that looks
 > for *.TIC instead of *.tic. Is there a way to edit the above line to look
 > for both *.tic and *.TIC?

In my above example, you could have

for i in fido/inbound/*.tic fido/inbound/*.TIC; do

And then have another test for the uppercase *.TIC, that "continues".


...лоег
--- SBBSecho 3.07-Linux
 * Origin: Alterant | An SBBS in Docker on Pi! (3:633/509)
SEEN-BY: 1/123 15/2 154/10 203/0 221/0 1 6 360 226/17 227/114 229/354
SEEN-BY: 229/426 1014 240/5832 249/206 317 400 280/464 5003 310/31
SEEN-BY: 317/3 320/219 322/757 342/200 396/45 633/0 267 280 410 412
SEEN-BY: 633/509 640/1321 1384 712/848 770/1 2452/250
PATH: 633/509 280 640/1384 221/1 280/464 229/426


<< oldest | < older | list | newer > | newest >> ]

(c) 1994,  bbs@darkrealms.ca