Overclockers Australia Forums
OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Programming & Software Development

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 21st August 2012, 2:04 PM   #1
ausghostdog Thread Starter
Member
 
Join Date: Feb 2010
Posts: 1,177
Default Cannot execute binary file?

Hi,
I am playing around with BASH in Debian. I Vim'ed a file called script1 inside script1 was
Code:
# My First script

   STR='HELLO World!'
   echo $STR
I then tried
Code:
bash script .script1
All I get is the error
Code:
/usr/bin/script: /usr/bin/script: can not execute binary file
This is my first time trying Bash so I gather I have missed something
__________________
WTB 2TB & 3TB Sata HDDs
ausghostdog is offline   Reply With Quote

Join OCAU to remove this ad!
Old 21st August 2012, 2:09 PM   #2
zach
Member
 
zach's Avatar
 
Join Date: May 2009
Location: chermside.bris.qld.au:80
Posts: 2,601
Default

Sounds like something isn't configured properly.

In shell try
PHP Code:
echo $PATH 
If /bin/ is missing, try

PHP Code:
export PATH=/bin:/usr/bin:/sbin:/usr/sbin 

EDIT: Haha whoops, call it like
Code:
./script1

Last edited by zach; 21st August 2012 at 2:14 PM.
zach is offline   Reply With Quote
Old 21st August 2012, 2:19 PM   #3
ausghostdog Thread Starter
Member
 
Join Date: Feb 2010
Posts: 1,177
Default

Quote:
Originally Posted by zach View Post
Sounds like something isn't configured properly.

In shell try
PHP Code:
echo $PATH 
If /bin/ is missing, try

PHP Code:
export PATH=/bin:/usr/bin:/sbin:/usr/sbin 

EDIT: Haha whoops, call it like
Code:
./script1
Yeah, just seen that also I forgot to ad execute for the file as well so had to run chmod. Well that was my first attempt at a bash script and I failed V.V. Ow well can only improve from here.
__________________
WTB 2TB & 3TB Sata HDDs

Last edited by ausghostdog; 21st August 2012 at 2:28 PM.
ausghostdog is offline   Reply With Quote
Old 21st August 2012, 2:31 PM   #4
zach
Member
 
zach's Avatar
 
Join Date: May 2009
Location: chermside.bris.qld.au:80
Posts: 2,601
Default

Don't let permissions get you down man, type it straight into your shell, I find an interactive REPL makes learning a new language much easier.
zach is offline   Reply With Quote
Old 21st August 2012, 2:36 PM   #5
ausghostdog Thread Starter
Member
 
Join Date: Feb 2010
Posts: 1,177
Default

Quote:
Originally Posted by zach View Post
Don't let permissions get you down man, type it straight into your shell, I find an interactive REPL makes learning a new language much easier.
Yeah, making the transition from Windows to Linux has been fun. Slowly learning all the commands. If it wasn't for uni I would never touch this. Something new to learn is always fun. I'll just remember to ls -l before I do anything on scripts from now on
__________________
WTB 2TB & 3TB Sata HDDs

Last edited by ausghostdog; 21st August 2012 at 2:46 PM.
ausghostdog is offline   Reply With Quote
Old 21st August 2012, 4:20 PM   #6
wwwww
Member
 
Join Date: Aug 2005
Location: Bangkok
Posts: 2,973
Default

chmod +x <filename>

then ./<filename>
__________________
wPrime 2.07 | Super PI 1.7
wwwww is offline   Reply With Quote
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 2:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!