Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Create Sym Links for a series of files

$
0
0
Hello,

I would like to create symbolic links for a series of files in my cwd (after confirming that the links don't already exist). The above files all have a similar prefix, but different extensions.

I created a shell script like shown below and I get an error message "No such file or directory"

Code:

#!/bin/sh

for x in `ls -1 /myRandomDir/myFiles.*`
do
    if [ ! -f $x ]
    then
        ln -s $x
    fi
done

What should I do differently.

Thanks!
~Guss

Viewing all articles
Browse latest Browse all 16232

Trending Articles