Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #3 parameters...
- #save as file.sh
- #chmod +x file.sh
- #./file.sh [input .asm file] [output executable file] [architecture 32/64]
- num=$#
- if (( num != "3" )); then
- echo -n "Sorry, needs 3 parameters. You have "
- echo $num
- exit
- fi
- clear
- ip=$1
- op=$2
- ts=$3
- tmp=TEMP_ASM_FILE.o
- echo "Compiling with NASM/LD"
- if [ $ts = "32" ]; then
- nasm -f elf32 -o $tmp $ip
- ld -s -m elf_i386 -o $op $tmp
- elif [ $ts = "64" ]; then
- nasm -f elf64 -o $tmp $ip
- ld -s -o $op $tmp
- else
- echo "You did not select an architecture"
- fi
- rm $tmp
- echo "Complete!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement