CSC231 Bash Tutorial 2

From dftwiki3
Revision as of 09:06, 9 February 2017 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =Your History= <br /> The Bash shell keeps track of all the commands you type, at least the most recent ones. This list of commands is kept in a file, and when y...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 09:06, 9 February 2017 (EST)


Your History


The Bash shell keeps track of all the commands you type, at least the most recent ones. This list of commands is kept in a file, and when you login to your Linux account, the commands that you typed the last time you were connected are still in this file, available to you.

Let's figure out how to use your history to reduce your typing.

  • If you do not have a working hello.asm program, get a copy of my version:
getcopy hello.asm

  • Assemble, link, and run your program
nasm -f elf hello.asm
ld -melf_i386 hello.o -o hello
./hello

  • You should see the message printed.
  • Edit hello.asm and modify the message, so that the program will print something different. It doesn't matter what.
emacs hello.asm

  • You now have to assemble, link, and run your program again to see the result of the modification. Instead of typing the commands again...
  • just press the UP arrow key on your keyboard a few times until your last nasm command. Press Enter when you have the command at the prompt.
  • then press UP arrow again a few times and get the last ld command. Enter
  • then press UP arrow again, and get ./hello
You get the idea!