Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All, Need some work-around for accessing a folder with an "&" in itz name. When I try accessing it, it takes only the first part of the folder_name and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    4

    Post Unable to Access a folder with "&" in the name


    Hi All,
    Need some work-around for accessing a folder with an "&" in itz name. When I try accessing it, it takes only the first part of the folder_name and throws an error as shown below.

    Ex : folder name: ./zigibae_&_NAME
    ls ./zigibae_&_NAME will give the error
    [1] 16690
    /usr/local/bin/ls: cannot access ./zigibae_: No such file or directory
    bash: _NAME: command not found.

    Please help me in this.

    Regards,
    Anand.
    Last edited by devils casper; 08-05-2008 at 12:20 PM. Reason: removed formatting tags.

  2. #2
    Just Joined!
    Join Date
    May 2008
    Location
    ┼snorrbodarna
    Posts
    8
    The '&' character is a special character in many shells (meaning that the preceding command should run as a background process). Therefore you need to escape it by preceding it with a backslash, or enclose the whole string in single quotes:

    ls ./zigibae_\&_NAME
    or
    ls './zigibae_&_NAME'

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    4
    Thanks for a very quick reply and for the solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •