Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- numArg=$#
- clear
- if [ $numArg != 3] ; then
- echo "You entered too many or too little arguments when expected 3"
- echo "you supplied only $numArg"
- echo "Usage: asmlearn.sh <input.asm> <program_name> <bits>"
- exit
- else
- echo "Compiling asm using NASM"
- input=$1
- output=$2
- inter=$2.o
- bits=$3
- nasm -f elf$bits -o $inter $input
- ret=$?
- if [ $ret != 0 ] ; then
- echo "NASM compile failed!"
- exit
- else
- echo "Compiling using GCC for final binary"
- gcc -m$bits -o $output $inter
- ret=$?
- if [ $ret != 0 ] ; then
- echo "There was a problem with linking!"
- exit
- else
- rm $inter
- echo "Compile finished!"
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement