bash functions arguments in single quotes -


i trying pass 2 arguments following bash function $1 , $2. if echo below statement seems output $1 , $2. need have arguments in single quotes function work correctly. doing wrong?

function mysql_diff() {     java -jar mysql-diff.jar 'jdbc:mysql://localhost:3306/$1?user=root&password=password' 'jdbc:mysql://localhost:3306/$2?user=root&password=password' } 

it seems need arguments enclosed in single quotes. achieve that, enclose in double quotes:

function mysql_diff() {     java -jar mysql-diff.jar "'jdbc:mysql://localhost:3306/$1?user=root&password=password'" "'jdbc:mysql://localhost:3306/$2?user=root&password=password'" } 

this not prevent variable expansion , result in arguments being enclosed in single quotes.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -