shell - When creating symbolic links on ubuntu I sometimes get an odd result -
i'm trying create bunch of symbolic links files in directory. seems like, when type command in shell manually, works fine, when run in shell script, or use arrow re-run it, following problem.
$ sudo ln -s /path/to/my/files/* /the/target/directory/
this should create bunch of sym links in /path/to/my/files , if type command in manuall, indeed does, however, when run command shell script, or use arrow re-run single symbolic link in /the/target/directory/ called * in link name '*' , have run
$ sudo rm *
to delete it, seems insane me.
when run command in script, there files in /path/to/my/files
? if not, default wildcard has nothing expand to, , not replaced. end literal "*". might want check out shopt -s nullglob
, run ln
command this:
shopt -s nullglob sudo ln -s -t /the/target/directory /path/to/my/files/*
Comments
Post a Comment