Advertisement
GoodiesHQ

Untitled

Mar 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/bash
  2. #3 parameters...
  3. #save as file.sh
  4. #chmod +x file.sh
  5. #./file.sh [input .asm file] [output executable file] [architecture 32/64]
  6. num=$#
  7. if (( num != "3" )); then
  8.     echo -n "Sorry, needs 3 parameters. You have "
  9.     echo $num
  10.     exit
  11. fi
  12. clear
  13. ip=$1
  14. op=$2
  15. ts=$3
  16. tmp=TEMP_ASM_FILE.o
  17. echo "Compiling with NASM/LD"
  18. if [ $ts = "32" ]; then
  19.     nasm -f elf32 -o $tmp $ip
  20.     ld -s -m elf_i386 -o $op $tmp
  21. elif [ $ts = "64" ]; then
  22.     nasm -f elf64 -o $tmp $ip
  23.     ld -s -o $op $tmp
  24. else
  25.     echo "You did not select an architecture"
  26. fi
  27. rm $tmp
  28. echo "Complete!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement