ln: invalid option â '/'
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
I have a situation with ln
and cannot solve this even after I've read about ln
in help.
Running the following command:
ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko
Provides the following error:
ln: invalid option -- '/'
How can I solve it?
command-line kernel symbolic-link
 |Â
show 2 more comments
up vote
2
down vote
favorite
I have a situation with ln
and cannot solve this even after I've read about ln
in help.
Running the following command:
ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko
Provides the following error:
ln: invalid option -- '/'
How can I solve it?
command-line kernel symbolic-link
what exactly did you try to do? what should be the meaning of**.ko
?
â Yaron
Feb 21 at 9:18
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Have you assigned to the variable$kernel_version
? If so, what is its value?
â Zanna
Feb 21 at 9:29
 |Â
show 2 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a situation with ln
and cannot solve this even after I've read about ln
in help.
Running the following command:
ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko
Provides the following error:
ln: invalid option -- '/'
How can I solve it?
command-line kernel symbolic-link
I have a situation with ln
and cannot solve this even after I've read about ln
in help.
Running the following command:
ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko
Provides the following error:
ln: invalid option -- '/'
How can I solve it?
command-line kernel symbolic-link
command-line kernel symbolic-link
edited Feb 21 at 9:43
![](https://i.stack.imgur.com/1MIVg.jpg?s=32&g=1)
![](https://i.stack.imgur.com/1MIVg.jpg?s=32&g=1)
Yaron
8,54271838
8,54271838
asked Feb 21 at 9:08
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
Aleksei Kovaltsuk
165
165
what exactly did you try to do? what should be the meaning of**.ko
?
â Yaron
Feb 21 at 9:18
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Have you assigned to the variable$kernel_version
? If so, what is its value?
â Zanna
Feb 21 at 9:29
 |Â
show 2 more comments
what exactly did you try to do? what should be the meaning of**.ko
?
â Yaron
Feb 21 at 9:18
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Have you assigned to the variable$kernel_version
? If so, what is its value?
â Zanna
Feb 21 at 9:29
what exactly did you try to do? what should be the meaning of
**.ko
?â Yaron
Feb 21 at 9:18
what exactly did you try to do? what should be the meaning of
**.ko
?â Yaron
Feb 21 at 9:18
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Have you assigned to the variable
$kernel_version
? If so, what is its value?â Zanna
Feb 21 at 9:29
Have you assigned to the variable
$kernel_version
? If so, what is its value?â Zanna
Feb 21 at 9:29
 |Â
show 2 more comments
2 Answers
2
active
oldest
votes
up vote
6
down vote
accepted
I'd suggest replacing the $kernel_version
variable with the actual value.
As described below, using the below command with backtick instead of single quote should solve the problem as well:
$ kernel_version=`uname -r`
As mentioned by @steeldriver the error seems to be due to use of single quote instead of backtick which surround the uname -r
command.
hence the following sample command:
$ kernel_version='uname -r'
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
Will be translated to:
$ ln -sf /tmp/test/uname -r/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
And as @steeldriver wrote: Presumably the error message is about invalid option '/'
because -r
is a valid option for the ln
command
Note that using backtick would work without errors:
$ kernel_version=`uname -r`
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
$
$ ls -l /tmp/newname
lrwxrwxrwx 1 user user 35 Feb 21 16:02 /tmp/newname -> /tmp/test/4.4.0-112-generic/example
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsukln
tries hard to find every option you enter, and as the content of the variable contains single hyphens-
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash/
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â Soln
says:
There's aninvalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean:-- '/'
.
â dessert
Feb 21 at 10:08
 |Â
show 3 more comments
up vote
0
down vote
Use the
$( ... )
notation instead of the old-style backticks`...`
for command substitution. It looks better, and nests better. And is less likely to be mixed up with quotes.Quote your variables. With the string
uname -r
inkernel_version
,/lib/modules/$kernel_version/extra/mISDN_core.ko
expands to the two words/lib/modules/uname
and-r/extra/mISDN_core.ko
, when you clearly wanted only one filename.Quoted,
"/lib/modules/$kernel_version/extra/mISDN_core.ko"
would expand to/lib/modules/uname -r/extra/mISDN_core.ko
as a single word, and you'd get an error fromln
because a file by that name does not exist.Not exactly necessary here if you quoted the variables properly, since your filenames start with a slash, but in general you may want to consider adding the double-dash
--
to signal the end of options. With filenames starting with dashes it has to be used so that the application can tell the difference between an option and a filename.As the classic example, consider what happens if you run
rm *
in a directory containing a file called-rf
.rm -- *
prevents the issue (as wouldrm ./*
).
Without doing (1) or (2), ln
indeed sees the string -r/kernel...
as one of the arguments, and as GNU ln
reads options from all arguments, not just the first ones, it takes -r
as a known option, and then errors on /
, since -/
is not an option it knows about.
So, in full, what you should do is:
kernel_version=$(uname -r)
ln -sf -- "/lib/modules/$kernel_version/extra/mISDN_core.ko"
"/lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko"
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
I'd suggest replacing the $kernel_version
variable with the actual value.
As described below, using the below command with backtick instead of single quote should solve the problem as well:
$ kernel_version=`uname -r`
As mentioned by @steeldriver the error seems to be due to use of single quote instead of backtick which surround the uname -r
command.
hence the following sample command:
$ kernel_version='uname -r'
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
Will be translated to:
$ ln -sf /tmp/test/uname -r/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
And as @steeldriver wrote: Presumably the error message is about invalid option '/'
because -r
is a valid option for the ln
command
Note that using backtick would work without errors:
$ kernel_version=`uname -r`
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
$
$ ls -l /tmp/newname
lrwxrwxrwx 1 user user 35 Feb 21 16:02 /tmp/newname -> /tmp/test/4.4.0-112-generic/example
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsukln
tries hard to find every option you enter, and as the content of the variable contains single hyphens-
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash/
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â Soln
says:
There's aninvalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean:-- '/'
.
â dessert
Feb 21 at 10:08
 |Â
show 3 more comments
up vote
6
down vote
accepted
I'd suggest replacing the $kernel_version
variable with the actual value.
As described below, using the below command with backtick instead of single quote should solve the problem as well:
$ kernel_version=`uname -r`
As mentioned by @steeldriver the error seems to be due to use of single quote instead of backtick which surround the uname -r
command.
hence the following sample command:
$ kernel_version='uname -r'
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
Will be translated to:
$ ln -sf /tmp/test/uname -r/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
And as @steeldriver wrote: Presumably the error message is about invalid option '/'
because -r
is a valid option for the ln
command
Note that using backtick would work without errors:
$ kernel_version=`uname -r`
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
$
$ ls -l /tmp/newname
lrwxrwxrwx 1 user user 35 Feb 21 16:02 /tmp/newname -> /tmp/test/4.4.0-112-generic/example
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsukln
tries hard to find every option you enter, and as the content of the variable contains single hyphens-
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash/
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â Soln
says:
There's aninvalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean:-- '/'
.
â dessert
Feb 21 at 10:08
 |Â
show 3 more comments
up vote
6
down vote
accepted
up vote
6
down vote
accepted
I'd suggest replacing the $kernel_version
variable with the actual value.
As described below, using the below command with backtick instead of single quote should solve the problem as well:
$ kernel_version=`uname -r`
As mentioned by @steeldriver the error seems to be due to use of single quote instead of backtick which surround the uname -r
command.
hence the following sample command:
$ kernel_version='uname -r'
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
Will be translated to:
$ ln -sf /tmp/test/uname -r/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
And as @steeldriver wrote: Presumably the error message is about invalid option '/'
because -r
is a valid option for the ln
command
Note that using backtick would work without errors:
$ kernel_version=`uname -r`
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
$
$ ls -l /tmp/newname
lrwxrwxrwx 1 user user 35 Feb 21 16:02 /tmp/newname -> /tmp/test/4.4.0-112-generic/example
I'd suggest replacing the $kernel_version
variable with the actual value.
As described below, using the below command with backtick instead of single quote should solve the problem as well:
$ kernel_version=`uname -r`
As mentioned by @steeldriver the error seems to be due to use of single quote instead of backtick which surround the uname -r
command.
hence the following sample command:
$ kernel_version='uname -r'
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
Will be translated to:
$ ln -sf /tmp/test/uname -r/example /tmp/newname
ln: invalid option -- '/'
Try 'ln --help' for more information.
And as @steeldriver wrote: Presumably the error message is about invalid option '/'
because -r
is a valid option for the ln
command
Note that using backtick would work without errors:
$ kernel_version=`uname -r`
$ ln -sf /tmp/test/$kernel_version/example /tmp/newname
$
$ ls -l /tmp/newname
lrwxrwxrwx 1 user user 35 Feb 21 16:02 /tmp/newname -> /tmp/test/4.4.0-112-generic/example
edited Feb 21 at 14:09
answered Feb 21 at 9:33
![](https://i.stack.imgur.com/1MIVg.jpg?s=32&g=1)
![](https://i.stack.imgur.com/1MIVg.jpg?s=32&g=1)
Yaron
8,54271838
8,54271838
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsukln
tries hard to find every option you enter, and as the content of the variable contains single hyphens-
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash/
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â Soln
says:
There's aninvalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean:-- '/'
.
â dessert
Feb 21 at 10:08
 |Â
show 3 more comments
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsukln
tries hard to find every option you enter, and as the content of the variable contains single hyphens-
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash/
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â Soln
says:
There's aninvalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean:-- '/'
.
â dessert
Feb 21 at 10:08
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
after replacing the '$kernel_version' with the actual name worked! thank you!
â Aleksei Kovaltsuk
Feb 21 at 9:37
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
thank you Yaron for update, I've read about it, occasionally that didn't solve a problem, but true name of $kernel did.
â Aleksei Kovaltsuk
Feb 21 at 9:45
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
just a simple question to the system, why error message doesn't describe the man problem? why it said invalid option - '/'?
â Aleksei Kovaltsuk
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsuk - Happy that your problem was solved!
â Yaron
Feb 21 at 9:47
@AlekseiKovaltsuk
ln
tries hard to find every option you enter, and as the content of the variable contains single hyphens -
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash /
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â So ln
says :
There's an invalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean: -- '/'
.â dessert
Feb 21 at 10:08
@AlekseiKovaltsuk
ln
tries hard to find every option you enter, and as the content of the variable contains single hyphens -
, âÂÂthis must be optionsâ it thinks. But before that, there's a path beginning with a slash /
. âÂÂThis must also be an option then because there are others behind it, but stop, I don't know an option beginning like that! Let's inform the user I found an invalid option and which character confuses me here.â So ln
says :
There's an invalid option
, find the strange thing in single quotes after the double hyphens so it's clear what character I mean: -- '/'
.â dessert
Feb 21 at 10:08
 |Â
show 3 more comments
up vote
0
down vote
Use the
$( ... )
notation instead of the old-style backticks`...`
for command substitution. It looks better, and nests better. And is less likely to be mixed up with quotes.Quote your variables. With the string
uname -r
inkernel_version
,/lib/modules/$kernel_version/extra/mISDN_core.ko
expands to the two words/lib/modules/uname
and-r/extra/mISDN_core.ko
, when you clearly wanted only one filename.Quoted,
"/lib/modules/$kernel_version/extra/mISDN_core.ko"
would expand to/lib/modules/uname -r/extra/mISDN_core.ko
as a single word, and you'd get an error fromln
because a file by that name does not exist.Not exactly necessary here if you quoted the variables properly, since your filenames start with a slash, but in general you may want to consider adding the double-dash
--
to signal the end of options. With filenames starting with dashes it has to be used so that the application can tell the difference between an option and a filename.As the classic example, consider what happens if you run
rm *
in a directory containing a file called-rf
.rm -- *
prevents the issue (as wouldrm ./*
).
Without doing (1) or (2), ln
indeed sees the string -r/kernel...
as one of the arguments, and as GNU ln
reads options from all arguments, not just the first ones, it takes -r
as a known option, and then errors on /
, since -/
is not an option it knows about.
So, in full, what you should do is:
kernel_version=$(uname -r)
ln -sf -- "/lib/modules/$kernel_version/extra/mISDN_core.ko"
"/lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko"
add a comment |Â
up vote
0
down vote
Use the
$( ... )
notation instead of the old-style backticks`...`
for command substitution. It looks better, and nests better. And is less likely to be mixed up with quotes.Quote your variables. With the string
uname -r
inkernel_version
,/lib/modules/$kernel_version/extra/mISDN_core.ko
expands to the two words/lib/modules/uname
and-r/extra/mISDN_core.ko
, when you clearly wanted only one filename.Quoted,
"/lib/modules/$kernel_version/extra/mISDN_core.ko"
would expand to/lib/modules/uname -r/extra/mISDN_core.ko
as a single word, and you'd get an error fromln
because a file by that name does not exist.Not exactly necessary here if you quoted the variables properly, since your filenames start with a slash, but in general you may want to consider adding the double-dash
--
to signal the end of options. With filenames starting with dashes it has to be used so that the application can tell the difference between an option and a filename.As the classic example, consider what happens if you run
rm *
in a directory containing a file called-rf
.rm -- *
prevents the issue (as wouldrm ./*
).
Without doing (1) or (2), ln
indeed sees the string -r/kernel...
as one of the arguments, and as GNU ln
reads options from all arguments, not just the first ones, it takes -r
as a known option, and then errors on /
, since -/
is not an option it knows about.
So, in full, what you should do is:
kernel_version=$(uname -r)
ln -sf -- "/lib/modules/$kernel_version/extra/mISDN_core.ko"
"/lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko"
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Use the
$( ... )
notation instead of the old-style backticks`...`
for command substitution. It looks better, and nests better. And is less likely to be mixed up with quotes.Quote your variables. With the string
uname -r
inkernel_version
,/lib/modules/$kernel_version/extra/mISDN_core.ko
expands to the two words/lib/modules/uname
and-r/extra/mISDN_core.ko
, when you clearly wanted only one filename.Quoted,
"/lib/modules/$kernel_version/extra/mISDN_core.ko"
would expand to/lib/modules/uname -r/extra/mISDN_core.ko
as a single word, and you'd get an error fromln
because a file by that name does not exist.Not exactly necessary here if you quoted the variables properly, since your filenames start with a slash, but in general you may want to consider adding the double-dash
--
to signal the end of options. With filenames starting with dashes it has to be used so that the application can tell the difference between an option and a filename.As the classic example, consider what happens if you run
rm *
in a directory containing a file called-rf
.rm -- *
prevents the issue (as wouldrm ./*
).
Without doing (1) or (2), ln
indeed sees the string -r/kernel...
as one of the arguments, and as GNU ln
reads options from all arguments, not just the first ones, it takes -r
as a known option, and then errors on /
, since -/
is not an option it knows about.
So, in full, what you should do is:
kernel_version=$(uname -r)
ln -sf -- "/lib/modules/$kernel_version/extra/mISDN_core.ko"
"/lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko"
Use the
$( ... )
notation instead of the old-style backticks`...`
for command substitution. It looks better, and nests better. And is less likely to be mixed up with quotes.Quote your variables. With the string
uname -r
inkernel_version
,/lib/modules/$kernel_version/extra/mISDN_core.ko
expands to the two words/lib/modules/uname
and-r/extra/mISDN_core.ko
, when you clearly wanted only one filename.Quoted,
"/lib/modules/$kernel_version/extra/mISDN_core.ko"
would expand to/lib/modules/uname -r/extra/mISDN_core.ko
as a single word, and you'd get an error fromln
because a file by that name does not exist.Not exactly necessary here if you quoted the variables properly, since your filenames start with a slash, but in general you may want to consider adding the double-dash
--
to signal the end of options. With filenames starting with dashes it has to be used so that the application can tell the difference between an option and a filename.As the classic example, consider what happens if you run
rm *
in a directory containing a file called-rf
.rm -- *
prevents the issue (as wouldrm ./*
).
Without doing (1) or (2), ln
indeed sees the string -r/kernel...
as one of the arguments, and as GNU ln
reads options from all arguments, not just the first ones, it takes -r
as a known option, and then errors on /
, since -/
is not an option it knows about.
So, in full, what you should do is:
kernel_version=$(uname -r)
ln -sf -- "/lib/modules/$kernel_version/extra/mISDN_core.ko"
"/lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko"
edited Feb 21 at 19:20
![](https://i.stack.imgur.com/eVuAv.png?s=32&g=1)
![](https://i.stack.imgur.com/eVuAv.png?s=32&g=1)
wjandrea
7,23342256
7,23342256
answered Feb 21 at 17:17
![](https://i.stack.imgur.com/O11k5.jpg?s=32&g=1)
![](https://i.stack.imgur.com/O11k5.jpg?s=32&g=1)
ilkkachu
981210
981210
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1008309%2fln-invalid-option%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
what exactly did you try to do? what should be the meaning of
**.ko
?â Yaron
Feb 21 at 9:18
hi. whole string is: ln -sf /lib/modules/$kernel_version/extra/mISDN_core.ko /lib/modules/$kernel_version/kernel/drivers/isdn/mISDN/mISDN_core.ko and I am trying to configure network in a box
â Aleksei Kovaltsuk
Feb 21 at 9:20
What is the idea of wildcards in your command? That will never work. You are supposed to change "#ker_ver" to the kernel you want this to do with and the same with the "**" That needs to be a name for a specific "ko".
â Rinzwind
Feb 21 at 9:22
Rinzwind, sorry for unclear example, I am going to fix it now
â Aleksei Kovaltsuk
Feb 21 at 9:23
Have you assigned to the variable
$kernel_version
? If so, what is its value?â Zanna
Feb 21 at 9:29