Create bash script with various alias? -


i'm creating script when run create various alias various scripts in other folders. script , other folders inside specific folder shown in image gonna executable when want too. assuming gonna execute on machine don't have change paths.

i got in script runs perfectly, prints echo , alias isn't created. if same alias line out of script creates alias perfectly.

this script i'm creating sh have influence on situation ?

now want use alias because folder going stay in machine , i'm not going have other people running these.

want able instead of going folders , run executables want script create alias can call them directly through prompt like$~ zenmap , runs.

#!/bin/bash  alias zenmap="/home/user/desktop/folder/nmap/zenmap/zenmap" echo "zenmap imported !" 

any clue on can happening ?

from comments in jayant answer seems confusing when functions executed. little example:

file_with_alias.sh

alias do_this="do_some_function" " sourcing file make function available not execute it! source file_with_function.sh  " create alias not execute it. alias execute_script="./path/to/script_that_does_something.sh" 

file_with_function.sh

do_some_function(){   echo "look ma! i'm doing things!" } 

script_that_does_something.sh

echo "doing directly!" 

now when source . file_with_alias.sh function not executed, alias generated. need execute alias do_this or call function work.

$ source file_with_alias.sh $ do_this ma! i'm doing things! $ execute_script doing directly! 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -