Skip to content
Advertisement

Assembly on Raspberry Pi gives the error “command not found” for every command

This is my first time using assembly on a Raspberry Pi. I don’t have sudo access so I can’t try running it that way. Anytime I try to do sudo it just throws an error.

When I try to run my program it returns this:

./test.s: line 1: .data: command not found    
./test.s line 2: .bealign: command not found    
./test.s line 3: x:: command not found

and so on for all the lines in the file. I have no idea how to fix this.

I’m running my program doing ./test.s ; echo $? I also tried doing it without the echo part and without the $? part and without the ./ part.

Advertisement

Answer

test.s is assembly source code, not bash shell.

Running it that way got your shell to try to source it or run bash test.s which can’t possibly work. That tries to run each line of assembler source code as a shell command.

Instead run gcc test.s to assemble+link it into an executable. If that doesn’t work you’ll need to find yourself a tutorial or book to learn some basics.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement