1

Unix shell scripting- how do I use the output of href in my shellscript. I need the link of a path alone to be as an output in my script. except for the email option. Please suggest me with other options. when I use the echo command the entire line is displayed, while I need only the link (Go)

#!/bin/sh
echo '<a href="https://unix.stackexchange.com">Go</a>'
melpomene
  • 84,125
  • 8
  • 85
  • 148
melony_r
  • 177
  • 1
  • 1
  • 8
  • could you be more specific in your question? what is your input for shell script? do you need to extract html links from it? – Alex Mar 17 '19 at 17:22
  • what is the problem to change you long line with "Go"? Do you need your link to be clickable in linux console? – Alex Mar 17 '19 at 17:24
  • Yes. i actually need a path and I need it clickable – melony_r Mar 17 '19 at 18:21
  • If I understand correctly, you want to extract "Go" from `Go`. Is this correct ? If so, you can use perl which probably have the most poweful regexes around `echo 'Go' | perl -pe 's|(.+)|\1|'` (thanks to [this question/reply](https://stackoverflow.com/questions/1103149/non-greedy-reluctant-regex-matching-in-sed). – mszmurlo Mar 18 '19 at 15:56
  • I need the link as a output in my shell script.. in this case i would need 'Go' which redirects me to the link. – melony_r Mar 19 '19 at 17:57

0 Answers0