osx - Remove brackets from phone number in run shell script -


i create custom workflow contacts app in mac in way can dial phone number through hyperlink.

these settings:

service receives selected 'phone numbers' in 'contacts.app'

pass input: arguments

script:

open "http://example.com/dial.htm?number=${@}" 

my problem phone numbers automatically formatted brackets , link not work: +44(0)123 456 789

how can modify script telephone number comes clean without brackets?

thanks in advance

you can use sed command replace () or ([0-9]) nothing:

#!/bin/sh  #replace brackets keep number inside brackets #url=`echo http://example.com/dial.htm?number=${@}|sed 's/[()]//g'`  #replace brackets number inside - i.e., (0) url=`echo http://example.com/dial.htm?number=${@}|sed 's/([0-9])//g'`  echo "${url}" ##open ${url} 

test:

./test.sh '+123(0)223465' http://example.com/dial.htm?number=+123223465 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -