On 2011-01-26 19:12, Daniel Gibson wrote:
Am 26.01.2011 09:36, schrieb Jacob Carlborg:
On 2011-01-25 23:59, Jesse Phillips wrote:
Jacob Carlborg Wrote:
Yeah, I guess you're right, didn't think there were a lot people who
used other shells. Since I almost know nothing about shell scripting and
even less about non-bourne shells, will it be possible to port to other
shells? How much do they differ?
--
/Jacob Carlborg
To add to Lutger's message. I believe it is sh that is required by all Posix
systems, or at least an equivalent. Similarly I think vi is also a requirement.
In all likelyhood you probably used a Bash specific feature, but usually
everyone has bash even if they use zsh... Though Ubuntu/Debian has started
pointing /bin/sh to dash which is complaint with posix...
Ok. I'll see I can use only sh.
Debian (and probably ubuntu as well) has a package called "devscripts" which
contains a handy tool called "checkbashisms". This tool tells you if your script
uses bash-specific stuff and often even suggests a more portable alternative.
That sounds like something I could use.
I haven't checked DVM yet, but if you want to have stuff done one login, put it
into ~/.profile instead of ~/.bashrc - this should be executed by all POSIX
compliant shells I think.
On Mac OS X I use .bash_profile, I don't know if .profile and/or .bashrc
works. The bash man page (http://linux.die.net/man/1/bash) says:
"When bash is invoked as an interactive login shell, or as a
non-interactive shell with the --login option, it first reads and
executes commands from the file /etc/profile, if that file exists. After
reading that file, it looks for ~/.bash_profile, ~/.bash_login, and
~/.profile, in that order, and reads and executes commands from the
first one that exists and is readable."
And:
"When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists."
I'm not sure I know the difference between "an interactive login shell"
and one that isn't.
I'm not 100% sure in what file to put the script in. But what I want is
to run a script when a new shell is started, like when you open the
Terminal in Ubuntu/Mac OS X or opens a new tab in the terminal.
Cheers,
- Daniel
--
/Jacob Carlborg