help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suddenly, periods / dots in variable values are converted to space


From: Greg Wooledge
Subject: Re: Suddenly, periods / dots in variable values are converted to space
Date: Mon, 23 Jan 2023 17:08:49 -0500

On Mon, Jan 23, 2023 at 02:17:30PM -0700, Chandler wrote:
> 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

1) You forgot to quote.

2) You have somehow managed to set IFS to a value which contains .

To fix this:

1) Use quotes when they are needed.  less "$File1" will suppress all
   IFS-based splitting.

2) IFS=$' \t\n' or unset IFS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]