Suddenly, periods / dots in variable values are converted to space
From:
Chandler
Subject:
Suddenly, periods / dots in variable values are converted to space
Date:
Mon, 23 Jan 2023 14:17:30 -0700
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.6.0
I don't know why this is suddenly happening, I haven't made any major changes
to bash or anything else in my shell that I can remember, but I've been working
around the clock on many things lately, there must be an explanation. I work
in a shared home directory and the versions of bash vary from system to system,
fun I know. On this particular machine, bash is 4.4.20. I have some variables
defined in ~/.bashrc for some files that I frequently reference, for example:
export File1="/dev/sda/file1.txt"
Previously, I could just use a command like `less $File1` and it would bring up
the file. Now, the dot in the filename is converted to a space and less tries
to open 2 separate files:
$ less $File1
/dev/sda/file1: No such file or directory
txt: No such file or directory
$
echo is also affected:
$ echo $File1
/dev/sda/file1 txt
$
I know it's safer to use curly braces and I've been doing that more and more,
but that doesn't help in this case, returning the same thing as echo. `set`
will show that the variable is still defined correctly, however:
$ set | grep File1
File1=/dev/sda/file1.txt
$
To get less or echo to work, now I have to put the variable in double-quotes (e.g. `echo
"$File1"`).
Any idea what could cause this change in behavior?
Thanks