|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to execute a bash file in terminal?
How do I execute a bash file in the terminal, after I created one?
|
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
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 ![]() |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
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! |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Opening a terminal with bash | gaurab | UNIX for Dummies Questions & Answers | 8 | 05-05-2011 01:02 PM |
| Run bash script without terminal | locoroco | Shell Programming and Scripting | 1 | 03-14-2011 08:35 PM |
| How to search a file in bash terminal? | andrewust | UNIX for Dummies Questions & Answers | 2 | 11-25-2010 11:44 AM |
| bash script won't execute (Mac) | compulsiveguile | Shell Programming and Scripting | 6 | 03-02-2010 12:48 AM |
| Execute command from terminal on remote machine | Ranu | Shell Programming and Scripting | 0 | 10-09-2007 04:13 AM |
|
|