2021年4月2日星期五

Properly quoting a tcsh alias using backticks

I'm using tcsh. I'd like to alias "cdup" to cd up to a directory one level down from a reference directory. For example, if my reference directory is /home/myself/support/bugs/, and I'm in /home/myself/support/bugs/bug1/foo/bar, I'd like cdup to change directory to /home/myself/support/bugs/bug1. I tried the following:

alias cdup 'cd `perl -e \'print $1 if $ENV{PWD} =~ m#\(/home/myself/support/bugs/[^/]+\)#\'`'

but I get:

Unmatched `.

https://stackoverflow.com/questions/66922879/properly-quoting-a-tcsh-alias-using-backticks April 03, 2021 at 01:17AM

没有评论:

发表评论