0

I get a load of stuff when I type the word

set 

in mac osx 10.8 terminal.

I only recognise a tiny bit of it is in my .profile and .bashrc files. I have looked also in /etc/paths

I cannot find where the output comes from. I have been searching about for a good while now and nothing extra has come up. Where is this command pulling the information output on the terminal from exactly?

e.g. this function update_terminal_cwd ()

4
  • Different things come from different places. We don't know what "stuff" you're asking about. Mar 30, 2013 at 3:45
  • @DavidSchwartz added example.
    – Magpie
    Mar 30, 2013 at 3:52
  • Check /etc/bashrc. Mar 30, 2013 at 4:03
  • I had done that firstly @DavidSchwartz
    – Magpie
    Apr 8, 2013 at 0:44

1 Answer 1

2

set is showing you all environmental variables and builtin functions that exist on your machine and in your shell among other information gathered.

If you want to know the full story, check the source code for the builtin.

To address your example, update_terminal_cwd is in the default systemwide .bashrc file:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
    local SEARCH=' '
    local REPLACE='%20'
    local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
    printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
1
  • Thank you. Although there's still work to do I think you answered as completely you could given the situation. Aside from that I have been trying to find the place where my PS1 is set for ages and finally I can get rid of the annoying PS1='\h:\W \u\$ 'and replace it with PS1='> ' thanks to you +1
    – Magpie
    Mar 30, 2013 at 4:46

Not the answer you're looking for? Browse other questions tagged .