Re: Changing directories, script, mc
- From: slakmagik <j@xxxxxxxxxxxxxxxx>
- Date: Thu, 17 Jan 2008 18:45:41 GMT
On 2008-01-17 Thu 11:08:32, john wrote:
I don't understand what you mean by "source it". Please explain. I found
Others have covered this,
the files mc.sh and mc-wrapper.sh. (I made them both executable). If I
say:
alias mc='. /usr/share/mc/bin/mc-wrapper.sh' [enter]
then mc works as I think it should, so I put that line in my .bashrc. :-)
It doesn't have to be executable, though it'll work that way, too.
Scripts only need to be executable in order to be executed directly. If
you're having the shell source it or giving it as an argument to the
shell, it doesn't need to be executable.
That line looks like what you are talking about re: "source it", but I
don't really understand the concept. If I say:
$. chap1 [enter] konsole exits immediately.
also if I first say:
$alias chap1='. chap1' [enter] then
$chap1 [enter] konsole exits immediately
If I say
$. chap1 [enter] in a console, it results in immediate logout.
I don't use konsole and I'm not sure what would be causing the
exit/logout - especially in a console. If the exit/logout command
appeared in the script, that would be what was doing it - you wouldn't
notice when run as a script, because the subshell would exit anyway, but
you would notice in the current context, because your current shell
would exit. But that's not in the script you gave. Or if you were
running konsole with '-e chap1' and no '-hold' (or equivalent) then it
would immediately exit. Which doesn't seem to be the case and still
wouldn't explain the console.
It works here, though.
I'm "all ears" about this making more sense as an alias or function, too.
As far as the alias, I meant make it an alias directly:
[ j@surfer ][ 01-17 13:34 ][ ~ ]
:alias chap1='cd /sys && ls'
[ j@surfer ][ 01-17 13:34 ][ ~ ]
:chap1
block bus class devices firmware fs kernel module power
Here, you're making it a sort of internal shell command that is issued
as a bare token (no 'sh foo' or '. foo'), is executed in the current
context, doesn't require a separate file (can be issued at the command
line for that instance of the shell or put in your ~/.bashrc for most
every instance of the shell), and shouldn't cause your shell to exit.
Search for /ALIAS in the bash manual (as well as reading up on functions
if you need replaceable parameters) and it talks about all this.
.
- Follow-Ups:
- Re: Changing directories, script, mc
- From: john
- Re: Changing directories, script, mc
- References:
- Changing directories, script, mc
- From: john
- Re: Changing directories, script, mc
- From: slakmagik
- Re: Changing directories, script, mc
- From: slakmagik
- Re: Changing directories, script, mc
- From: john
- Changing directories, script, mc
- Prev by Date: Re: Changing directories, script, mc
- Next by Date: Re: Changing directories, script, mc
- Previous by thread: Re: Changing directories, script, mc
- Next by thread: Re: Changing directories, script, mc
- Index(es):
Relevant Pages
|