The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash: Exiting while true loop when terminal is not the focus window acclaypool Shell Programming and Scripting 2 02-25-2008 06:02 PM
Execute command from terminal on remote machine Ranu Shell Programming and Scripting 0 10-09-2007 05:13 AM
how to execute sh script in bash shell via crontab jigarlakhani UNIX for Dummies Questions & Answers 1 06-23-2007 09:50 PM
loop does not execute in bash script? fedora Shell Programming and Scripting 2 01-16-2007 12:38 PM
Plz Help : How to use write command to execute command on some other terminal Aashish UNIX for Dummies Questions & Answers 2 03-03-2006 12:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-05-2007
Hyunkel Hyunkel is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 4
How to execute a bash file in terminal?

How do I execute a bash file in the terminal, after I created one?
  #2 (permalink)  
Old 10-06-2007
maximas maximas is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 11
simple type bash space and the file name
$ bash bar
$ sh bar
$ ./bar
if ur using ./ means ten u hav to change the premission chmod 755
  #3 (permalink)  
Old 10-06-2007
tomas's Avatar
tomas tomas is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 35
the standard method for calling the shell for a script is to declare it in the first line of the file. Also called the shebang #!

file: demo.sh

Code:
#!/bin/bash
echo Hello, world!

Change the file to executable and run it from the terminal.


Code:
$ chmod +x demo.sh
$ ./demo.sh
Hello, world!

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0