0

I am writing a simple script to clean up log folders. This is the most basic thing I can think of, and yet it does not work because the variables don't seem to be set. Here is the shell script beginning, where it fails:

#!/bin/bash
X3DBASE=/data/DassaultSystemes/R2020x
echo X3DBASE=$X3DBASE
read

And, here is the output:

$ ./cleanlogs.sh
X3DBASE=
^C
$

What am I doing wrong? I also tried removing the first line, in case a shell specification were somehow messing things up.

Jay Imerman
  • 121
  • 1
  • 6
  • Works for me. Are you running the correct script? – choroba Nov 16 '20 at 14:32
  • check for spaces around the = sign, ensure no typos in variable names, etc. – mpez0 Nov 16 '20 at 14:34
  • Yeah, I did check for spaces, no spaces. If I modify the echo command and re-run, the output changes, so I am definitely running the same script (good 'newb' question tho!). – Jay Imerman Nov 16 '20 at 17:09
  • Try putting `set -x` at the beginning of the script, so it'll print an execution trace as it runs and you can get a better idea what bash thinks is happening. – Gordon Davisson Nov 16 '20 at 20:23

1 Answers1

1

OK, this is a perfect case of misreading the screen. The variable names are so close but 1 character different. Put this one down to error between seat and keyboard.

Jay Imerman
  • 121
  • 1
  • 6