first line of a BASH script
-
- Posts: 145
- Joined: Sat 29 May 2010, 14:56
- Location: Heaven, Dell X1:NO HDD, NO CD, NO FAN Pup 4.3.1 USB Boot............................ {RAP SUCKS!}
first line of a BASH script
isn't it supposed to be
#!/bin/bash
so you can run the script without having to type './'
it won't work on mine.
#!/bin/bash
so you can run the script without having to type './'
it won't work on mine.
Is the script executable?
Code: Select all
chmod +x script_name
Code: Select all
#!/bin/bash
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.
Raspberry Pi without Puppy? No, thanks.
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
I put them in my-applications/binmuggins wrote:Plus, the file script_name, will only run as script_name if it's in the executable search PATH. Probably simplest to copy it to /usr/bin.
On puppy, my-applications/bin is in the search path and is nearly empty. As a result, it is easy to find the scripts I have made.
Yes i keep my scripts in the same place.Moose On The Loose wrote:I put them in my-applications/binmuggins wrote:Plus, the file script_name, will only run as script_name if it's in the executable search PATH. Probably simplest to copy it to /usr/bin.
On puppy, my-applications/bin is in the search path and is nearly empty. As a result, it is easy to find the scripts I have made.
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
I didn't know that it didn't need to have the "x" set.amigo wrote:Calling a script using simply the program name requires the program/script to be executable. Calling them as an argument to the shell doesn't require them to be executable. Also, 'sourcing' them ( . path/to/script/or/program ) doesn't require them to be executable.
The
Code: Select all
. /root/my-applications/moose/defaults
if test -e /root/my-applications/moose/settings; then
. /root/my-applications/moose/settings
fi
. /root/my-applications/moose/make_gui
... etc ..]
The real advantage to 'sourcing' is that all environment variables are available to the sourced code, without having to export anything. And, anything set (variable values) by the sourced script are available to the main script. Executing external scripts as separate processes does neither. Also, when sourcing an external script, the sourced file doesn't need any shebang at all.
True and while on the topic that's why I source Midnight Commander to run it. All my aliases are available to me.amigo wrote:"And, anything set (variable values) by the sourced script are available to the main script."
I wonder how many people use Midnight Commander. I use as my only file manager. Except for Rox, when I want to view thumbnails for icons, xpm and other image files
I even removed Rox as the desktop manager. Just use JWM and its wallpaper features. One wallpaper for each desktop.
~