You are not logged in.

#1 2012-01-03 20:38:35

akumixx
Member
Registered: 2011-05-03
Posts: 59

[Solved] Scripts on a wrong place creates execute loop?

I made a prepend path for executing in the system.
When I add scipts with commands:
sudo mount
ls
with a '  $@ '
it makes loop when called and starting new bash commandline.
I guess system is forced to use my scripts and can not use original mount

when used as alias there is no $@
when used as script the $@ is needed

What makes the problem ?
it makes mount command to loop and execute many times.

Last edited by akumixx (2012-01-03 21:37:34)

Offline

#2 2012-01-03 20:48:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Scripts on a wrong place creates execute loop?

I have trouble understanding what you mean. Can you post the output of 'which mount'?
Aliases don't take arguments (like $1 or $@).

Offline

#3 2012-01-03 21:36:09

akumixx
Member
Registered: 2011-05-03
Posts: 59

Re: [Solved] Scripts on a wrong place creates execute loop?

/bin/mount

What I did was
add path to my directory
and there is mount file as executable
there is inside
sudo mount $@
and thats the problem.....
I just realized...
I call mount command -- it calls mount command also. which also and also and also........
BECAUSE MY SCRIPT NAME AND SYSTEM COMMAND ARE THE SAME.
I agree to delete this thread....

Offline

#4 2012-01-03 22:56:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: [Solved] Scripts on a wrong place creates execute loop?

You could have your script called "mount" in some location other than /bin/, such as ~/bin/mount.  Inside ~/bin/mount instead of calling just "mount" call "/bin/mount" and it will unambiguously refer to the system command rather than your script.  eg

#!/bin/bash
# this is an executable script called 'mount' in my ~/bin/ which has been added to my PATH variable

/bin/mount $@

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2012-01-03 23:07:30

akumixx
Member
Registered: 2011-05-03
Posts: 59

Re: [Solved] Scripts on a wrong place creates execute loop?

thanks thats what I was looking for, after your post, this thread is fully solved.

Offline

#6 2012-01-03 23:53:47

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [Solved] Scripts on a wrong place creates execute loop?

alternatively, use 'command mount' to force a pathname lookup.

edit: and you really should be quoting "$@".

Last edited by falconindy (2012-01-03 23:53:59)

Offline

#7 2012-01-03 23:58:56

akumixx
Member
Registered: 2011-05-03
Posts: 59

Re: [Solved] Scripts on a wrong place creates execute loop?

I did not find the diference about "$@" in my example
--
You did not specify any switch or I dont know what you say or command mount is a magic thing that Ive never heard of.

Offline

Board footer

Powered by FluxBB