On 19/12/14 08:45, Eric Deveaud wrote:
> Barriere, Francois <fra...@at...> écrit :
>> Le 15/12/2014 13:44, Eric Deveaud a écrit :
>>> I pushed to git some modifications on the set/unset alias//function depending on the shell mode
>>>
>>> can you check it and let me know if the behaviour you've experienced is resolved.
>> I compiled the latest on "master", is it the right version?
> yep
>
>> The problem is partially resolved. There is no more error, but in the
>> not-interactive case, I see cases (no parameter to the alias) where
>> the set and unset functions generate different results.
> yes if _alias_ takes an argument then it's a function, an so it is treated accordingly
>
>
>> I have used the follosing simple module for my tests:
>>
>> -----------------------------------------------------------------------------------
>> #%Module1.0
>>
>> set-alias toto "ls -l"
>> set-alias titi "ls -l $*"
>> -----------------------------------------------------------------------------------
>>
>> When loaded/unloaded in non-interactive mode (through the LSF
>> scheduler, on a remote machine), it generates the following results
>> (the output of modulecmd, not eval'ed):
>>
>> ******************************************************
>> LOADEDMODULES=module/use.own:mytestmod ;export LOADEDMODULES;_LMFILES_=/eng/ref/sw/atmel/modulefiles/latest/modulefiles/misc/module/use.own:/home/fbarriere/privatemodules/mytestmod ;export _LMFILES_;alias toto='ls -l';titi() { ls -l ${1+"$@"};};
>> ******************************************************
>> LOADEDMODULES=module/use.own ;export LOADEDMODULES;_LMFILES_=/eng/ref/sw/atmel/modulefiles/latest/modulefiles/misc/module/use.own ;export _LMFILES_;unset -f toto;unset -f titi;
>> ******************************************************
>>
>> The first alias, without params is defined as an alias, but undefined as
>> a functions.
>
> definitively something wrong in the code modification I've performed.
> toto should be "unaliased" not "unset -f"
>
> thanks for your feedback.
>
> Eric
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
Hi,
Sorry if this has already been asked but I have come late to this
thread; is there any reason to ever map module 'alias' to bash 'alias'?
Since a bash function can have zero arguments it would seem simpler to
always create a function in bash and always do "unset -f " to unalias?
I realise that there are subtle differences in how arguments are
expanded for aliases versus functions in bash.
Perhaps to properly replace 'bash alias' with a function the
alias-string would need ' "$@"' appended to it if it contained no $ args.
Rob
|