Description
Given a file name, we want to compose a command line based on it:
- the command is 'ln',
- the first argument is '-f',
- the second one is the name translated from the file name
by replacing every slash('/') with a dot('.'),
- and the last one is the original file name.
|
| Raw Input
| foo/bar/dir1/blah.html
foobar/dir2/check.sh
|
|
| Desired Output
| ln -f foo/bar/dir1/blah.html foo.bar.dir1.blah.html
ln -f foobar/dir2/check.sh foobar.dir2.check.sh
|
|
Script and Comments
Script1 [ 1] h
[ 2] y/\//./
[ 3] H
[ 4] x
[ 5] s/^\(.*\)\n/ln -f \1 /
| |