Setting up an Alias in tcsh for a function defined in a bash script -


i have cshrc file aliases, in file want set alias point function defined in bash file.

bash function file aliasfunc:

function aaa()  {   echo stackoverflow  } 

example .cshrc file:

bash -c 'source aliasfunc'  alias bashfunc aaa  bashfunc #calling bashfunc 

sourcing .cshrc file results in following error:

bashfunc: command not found. 

what bash -c 'source aliasfunc' in cshrc file start new bash shell, load aliasfunc file, , exit. not affect parent csh shell @ all.

it happens bash , csh both have source keyword, doesn't mean it's somehow "compatible". you're trying equivalent of trying import python module in perl starting new python process within perl program.

what can along lines of:

$ alias bashfunc 'bash -c "source aliasfunc && aaa"' $ bashfunc stackoverflow 

every time bashfunc alias invoked start new bash shell source aliasfunc file and run bash aaa function.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -