简体   繁体   中英

How to find and replace forwardslashes with colons in bash script?

What I'm trying right now:

dir=$(pwd)
dir=${$dir//\//:}

But this isn't working for some reason.

The whole point of this is to convert a bash path to an applescript path, without hardcoding the path in there.

I'm essentially trying to do the opposite of this: https://apple.stackexchange.com/questions/4938/how-to-change-applescript-path-to-a-terminal-style-path

您的语法略有偏离,请不要 ${}构造中的变量上使用$

dir=${dir//\//:}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM