Results 1 to 4 of 4

Thread: sh and bash aliases

  1. #1

    Default sh and bash aliases

    I apologize if this has been asked before but I was curious about something:

    if i open up konsole and enter 'alias' i see all the standard aliases and any of my custom ones i've put in .bashrc

    now if enter 'sh' in konsole and then enter alias, where do those come from? there are only the predefined aliases from bash.bashrc.

    the reason i'm asking is that i've got an app that tries to display a webpage by invoking sh and calling netscape. i could recompile the app from source and replace netscape with seamonkey or firefox but i'd rather not change the code with a hack like that. another way would be for it to use the web browser env variable but i'm not sure of how to incorporate that into the code.

    from GTKRadiant 1.5 url.cpp source
    Code:
    snprintf (command, sizeof(command), 
                "netscape -remote \"openURL(%s,new-window)\" || netscape \"%s\" &", url, url);
    anyway, i thought i'd do it with an alias, but sh isn't reading from .bashrc. i also tried .profile with both sh and bash alias format.

    any help would be appreciated

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: sh and bash aliases

    A simpler solution that doesn't rely on aliases (which won't work if the process doesn't go through a shell to execute a child process). Make a symlink from firefox to netscape:

    Code:
    ln -s /usr/bin/firefox /usr/bin/netscape
    or /usr/local/bin/netscape if that's in everybody's path, then your change is local.

  3. #3

    Default Re: sh and bash aliases

    i already figured i'd just make a symlink in my bin but i was mainly curious about where sh gets it's aliases.

    thanks for the help

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: sh and bash aliases

    From any of the files that are read by bash at startup, e.g. /etc/profile /etc/profile.d/* /etc/bash.bashrc, ~/.bashrc, ~/.bash_profile and files that may be sourced by them. See man bash for details. Also note that when invoked as sh, slightly different rules apply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •