Populate alias DB from a bash script

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












My script startalias.sh:



#!/bin/sh
alias ls='ls -al --color=auto'


When I run this script my alias database does not pick it up.
But if I write it directly in the shell it works.
why?







share|improve this question






















  • If I copy that into my shell I get three error messages.
    – Hauke Laging
    Nov 20 '17 at 21:28














up vote
0
down vote

favorite












My script startalias.sh:



#!/bin/sh
alias ls='ls -al --color=auto'


When I run this script my alias database does not pick it up.
But if I write it directly in the shell it works.
why?







share|improve this question






















  • If I copy that into my shell I get three error messages.
    – Hauke Laging
    Nov 20 '17 at 21:28












up vote
0
down vote

favorite









up vote
0
down vote

favorite











My script startalias.sh:



#!/bin/sh
alias ls='ls -al --color=auto'


When I run this script my alias database does not pick it up.
But if I write it directly in the shell it works.
why?







share|improve this question














My script startalias.sh:



#!/bin/sh
alias ls='ls -al --color=auto'


When I run this script my alias database does not pick it up.
But if I write it directly in the shell it works.
why?









share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '17 at 21:30









Hauke Laging

53.6k1282130




53.6k1282130










asked Nov 20 '17 at 21:17









vancloud

33




33











  • If I copy that into my shell I get three error messages.
    – Hauke Laging
    Nov 20 '17 at 21:28
















  • If I copy that into my shell I get three error messages.
    – Hauke Laging
    Nov 20 '17 at 21:28















If I copy that into my shell I get three error messages.
– Hauke Laging
Nov 20 '17 at 21:28




If I copy that into my shell I get three error messages.
– Hauke Laging
Nov 20 '17 at 21:28










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










alias is a shell builtin. Executed in a subshell (like in a script) does not affect the main shell.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405853%2fpopulate-alias-db-from-a-bash-script%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    alias is a shell builtin. Executed in a subshell (like in a script) does not affect the main shell.






    share|improve this answer
























      up vote
      1
      down vote



      accepted










      alias is a shell builtin. Executed in a subshell (like in a script) does not affect the main shell.






      share|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        alias is a shell builtin. Executed in a subshell (like in a script) does not affect the main shell.






        share|improve this answer












        alias is a shell builtin. Executed in a subshell (like in a script) does not affect the main shell.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '17 at 21:29









        Hauke Laging

        53.6k1282130




        53.6k1282130



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405853%2fpopulate-alias-db-from-a-bash-script%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            The Forum (Inglewood, California)

            Palaiologos