Skip to content

Tilde in Quotes With External Command Not Working #3329

Closed

Description

@schrieveslaach

Describe the bug
When I use a path starting from home with tilde and wrapped into quote, the external command does not find the file.

To Reproduce
Steps to reproduce the behavior:

  1. Create a text file in your home, e.g. ~/test.txt
  2. Print the file with cat "~/text.txt" (quotes are necessary to reproduce)
  3. cat complains that it cannot find '~/test.txt'

Expected behavior

cat should print the content of ~/text.txt

Configuration (please complete the following information):

Run version | pivot and paste the output to show OS, features, etc.

────┬────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
 #  │      Column0       │                                               Column1                                                
────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
  0 │ version            │ 0.29.0                                                                                               
  1 │ branch             │ master                                                                                               
  2 │ short_commit       │ ad539cff                                                                                             
  3 │ commit_hash        │ ad539cff8c4ae36b7ce89ebbdb38c9d2277d51f8                                                             
  4 │ commit_date        │ 2021-03-31 01:10:45                                                                                  
  5 │ build_os           │ linux-x86_64                                                                                         
  6 │ rust_version       │ rustc 1.48.0 (7eac88abb 2020-11-16)                                                                  
  7 │ rust_channel       │ stable-x86_64-unknown-linux-gnu (default)                                                            
  8 │ cargo_version      │ cargo 1.48.0 (65cbdd2dc 2020-10-14)                                                                  
  9 │ pkg_version        │ 0.29.0                                                                                               
 10 │ build_time         │ 2021-04-02 15:20:58                                                                                  
 11 │ build_rust_channel │ release                                                                                              
 12 │ features           │ clipboard-cli, ctrlc, default, directories, dirs, ichwh, ptree, rustyline, term, trash, uuid, which, 
    │                    │ zip                                                                                                  
────┴────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────

The main branch's version does not work either:

────┬────────────────────┬───────────────────────────────────────────────────────────────────────
 #  │      Column0       │                                Column1                                
────┼────────────────────┼───────────────────────────────────────────────────────────────────────
  0 │ version            │ 0.29.2                                                                
  1 │ branch             │ main                                                                  
  2 │ short_commit       │ 033df945                                                              
  3 │ commit_hash        │ 033df9457b32f2e52447e5068cc8e13f577eabd5                              
  4 │ commit_date        │ 2021-04-18 20:40:29                                                   
  5 │ build_os           │ linux-x86_64                                                          
  6 │ rust_version       │ rustc 1.51.0 (2fd73fabe 2021-03-23)                                   
  7 │ rust_channel       │ stable-x86_64-unknown-linux-gnu (default)                             
  8 │ cargo_version      │ cargo 1.51.0 (43b129a20 2021-03-16)                                   
  9 │ pkg_version        │ 0.29.2                                                                
 10 │ build_time         │ 2021-04-18 20:44:30                                                   
 11 │ build_rust_channel │ debug                                                                 
 12 │ features           │ ctrlc, default, directories, dirs, ichwh, rustyline, term, which, zip 
────┴────────────────────┴───────────────────────────────────────────────────────────────────────

Activity

  1. ilius commented on May 7, 2021

    @ilius
    Contributor

    I don't think this is a nice behavior.
    Unless we differentiate double quote and single quote.
    What if your path contains the character ~?

    The main reason we may want to use quotation for this case is if the path contains space. For that I think it's best to support \ instead.
    For example ls ~/my\ test\ file.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions