Take the 2-minute tour ×

Given a command entered at a normal bash prompt, how does bash read that line once you hit enter? does it do variable substitution then command substitution? or does it do bash expansion first? or what?

Given the command below, what does bash do start to finish?

for i in *.meow; do 
   cat <<WUTLOL
   FILE ${PWD}/$i
   scp $i $(grab_server.sh kitten_blast{1..3}): 
share|improve this question

1 Answer 1

up vote 2 down vote accepted

The Bash wiki explains this quite well. Paraphrasing:

  1. Read data to execute
  2. Process quotes
  3. Split the read data into commands
  4. Parse special operators
  5. Perform expansions
  6. Split the command into a command name and arguments
  7. Execute the command
share|improve this answer

Your Answer


