There is no problem putting it in your .profile. As a user, you are responsible for what is in your profile and you can change things as you like them. You are the owner of the file and it is in a directory owned by you.
When you, as system manager, decide it is something all of your users should get when they log in, you can put it in /etc/profile.local.
It still is a “magic number” that should tell the kernel which what the script should be executed.
IMHO there is no need to drown the poor new users in all sorts of details and excepetions upon exceptions.
But of course you may think different.
BTW, I see a command like your example:
sh something
as a call of the POSIX shell to interprete the statements in the file something. No shebang needed (I hope the file contains POSIX shell syntax).
(IIAC, when that file start with a shebang, then the POSIX shell will let the kernel load the program mentioned there for the interpreting of the file).
Again, you may think different. But in my trial to let people that write scripts use a shebang so that the correct interpreter is used (being that python, the C-shell, the Korn shell, or whatever) I try to convene that message in the most simple and understandable form.
Again you may think different and decide that my educational habits are lousy.
On 2013-04-14 14:06, hcvv wrote:
>
> robin_listas;2547579 Wrote:
>> On 2013-04-14 12:36, hcvv wrote:
>>> What you show there is not a script, but it is a statmeent. A very nice
>>> one! And if it helps you, that is fine.
>>
>> My understanding is that he added that line to the end of the default
>> “~/.profile” file. I’m dubious if doing this is the correct thing to
>> do.
>
> I am not discussing where he put/typed this. Only he says he wrote a
> script. And I try to explain to him that a simple or complex statement
> is not he same as a script.
He said “It’s my very first bash script, so be nice!”. He also said that
“the addition to .profile is”…
Thus, he is a novice, does not know what a script really is, he is just
adding a line to “.profile”, and “.profile” is perhaps not really a
script. At least, it does not have a shebang
All that talking about scripts and shebangs is probably moot. What we
should consider is if that line he adds is correct for his purpose
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
On 04/14/2013 01:06 PM, hcvv wrote:
>
> At cjox,
>
> It still is a “magic number” that should tell the kernel which what the
> script should be executed.
> IMHO there is no need to drown the poor new users in all sorts of
> details and excepetions upon exceptions.
>
> But of course you may think different.
>
> BTW, I see a command like your example:
>
> Code:
> --------------------
> sh something
> --------------------
>
> as a call of the POSIX shell to interprete the statements in the file
> -something.- No shebang needed (I hope the file contains POSIX shell
> syntax).
> (IIAC, when that file start with a shebang, then the POSIX shell will
> let the kernel load the program mentioned there for the interpreting of
> the file).
>
> Again, you may think different. But in my trial to let people that
> write scripts use a shebang so that the correct interpreter is used
> (being that python, the C-shell, the Korn shell, or whatever) I try to
> convene that message in the most simple and understandable form.
>
> Again you may think different and decide that my educational habits are
> lousy.
It’s not that shebang isn’t a good idea. Obviously it is a good idea. I was
just pointing out the flaw in your statement that a shell script is a file
starting with “shebang” That is a false statement. That’s all.
I was merely seeking to adjust your attitude (you seemed a bit haughty) as you
were trying to address the problem. Just showing that maybe, just maybe, you
not as smart as you thought you were. Everyone can learn something… hope you
learned a bit of why things are the way they are.
Do not confuse (your opinion of) simple and understandable with the truth.
You seem to have confused the two.
Let me restate that… I’m not going to lie to someone in order to produce the truth I desire (well… not intentionally anyhow). Not saying that was your
intent, but your responses sure do make it sound that way. So… you take your
licks… you learn… you move on knowing better the next time around.
So, it’s not about your trial or my experiments have shown etc… while
those things can sometimes yield beneficial things, sometimes they can end up
hiding a truly useful feature or function that you never considered before. I’m
just saying you need to be careful… (and in this case you were a bit on the
path of covering up some of the power and potential of bourne shell variants).
Don’t be afraid to learn something… even if it means changing your view a bit.