>>>to use ~ as file ..
>>>'~' n "~"
>>>or ./~

Yes I know that. A beginner may not know or may not realize on time.

>>>I'm not sure this would fly as the new default.

I wouldn't make it default either, but it can easily be activated in ~/.bashrc 
for beginners.



________________________________
From: microsuxx <fxmb...@gmail.com>
Sent: Wednesday, February 12, 2025 9:29:40 PM
To: Andrés Rodríguez Reina <are...@gmv.com>
Cc: bug-bash <bug-bash@gnu.org>; Marina López Seoane 
<marina.lopez.seo...@gmv.com>
Subject: Re: [Suggestion] Add warning/error when using the tilde expansion in a 
folder where the tile-named file/folder exists


or \~

On Wed, Feb 12, 2025, 9:05 PM microsuxx 
<fxmb...@gmail.com<mailto:fxmb...@gmail.com>> wrote:
to use ~ as file ..

'~' n "~"
or ./~

On Wed, Feb 12, 2025, 5:21 PM Andrés Rodríguez Reina 
<are...@gmv.com<mailto:are...@gmv.com>> wrote:
Subject: [Suggestion] Add warning/error when using the tilde expansion in a 
folder where the tile-named file/folder exists

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-Smvct5/bash-5.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall 
-Wno-parentheses -Wno-format-security
uname output: Linux ltarrr 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 
21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 17
Release Status: release

Description:
        Due to a mistake in coding a script, a folder named '~' was generated. 
An unexperienced bash user issued the command "rm -rf ~" by mistake, intending 
to delete the '~' folder, but this resulted in deleting 150GB+ of data at their 
home directory.
        In my opinion, it would be useful to have a warning be issued when in 
interactive mode, when at the current working directory a file/folder named '~' 
exists, and a command with a parameter starting with ~ is used (which will 
produce tilde expansion).

Repeat-By:
        Create a file/folder named '~': mkdir '~'
        Try to delete it with a bogus command (DO NOT EXECUTE): rm -rf ~

Fix:
        When in interactive mode and when a suitable flag is activated, an 
error should appear. For example:
        <Error: use of ~ is ambiguous. Please either specify '~' or type the 
home path to avoid ambiguity.>

Thank you for your time,
Andres R

P Please consider the environment before printing this e-mail.
  • [S... Andrés Rodríguez Reina
    • ... Lawrence Velázquez
      • ... Andrés Rodríguez Reina
        • ... Lawrence Velázquez
    • ... microsuxx
      • ... microsuxx
        • ... Andrés Rodríguez Reina via Bug reports for the GNU Bourne Again SHell
    • ... Dale R. Worley
    • ... Chet Ramey

Reply via email to