简体   繁体   中英

Find and replace string in parameter bash

$ ./myscript my.site.com

How do I replace all dots in the first parameter? Here's my current try but it's returning a bad substition error.

#!/bin/bash
dbname=${$1//./_}

echo $dbname
dbname=${1//./_}

因为$1${1}是相同的,所以在1之前删除$

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