I am trying to write an alias for the following command that takes your current working directory, surrounded by quotes, and copies it to the clipboard.
echo \"$(pwd)\" | xclip
However, writing an alias for this in .bashrc
is not working quite right. This is the alias I have written:
alias cpwd="echo \"\$(pwd)\" | xclip"
But when that command is ran the double quotes are omitted. I have checked answers to similar problems, such as bash alias command with both single and double quotes, but I think I am escaping all the required characters, so I do not know why this command isn't working.
The current result of the command would be something like: home/user/My Folder
rather than "home/user/My Folder"
like I am wanting.