Editing a command-line argument to create a new variable
- by user1883614
I have a bash script called test.sh that uses command-line argument:
lynx -dump $1 > $name".txt"
But I need name to be created from the argument by specific keywords in the argument.
An example is:
http://www.pcmag.com/article2/0,2817,2412941,00.asp
http://www.pcmag.com/article2/0,2817,2412919,00.asp
Both are two separate articles but are the difference can only be seen in those 12 characters. How do I create a variable from a url for those 12 characters? So that when I run test.sh in Terminal:
./test.sh http://www.pcmag.com/article2/0,2817,2412941,00.asp
there is a text file saved as 0,2817,2412941,00?