digitalmars.D.announce - DVM - D Version Manager
- Jacob Carlborg (15/15) Jan 24 2011 I've created a tool that installs and manages D compilers and different
- Nick Sabalausky (7/20) Jan 24 2011 Yay! That sounds great!
- Don (9/39) Jan 25 2011 FWIW, I just copy all the versions of dmd into olddmd/dmd2051, etc, and
- Lars T. Kyllingstad (4/43) Jan 25 2011 Won't the script have to somehow set the import and library paths as
- Steven Schveighoffer (5/47) Jan 25 2011 No, dmd uses the config file in the same directory as the exe. This
- Lars T. Kyllingstad (6/56) Jan 25 2011 Ah, forgot about dmd.conf. I always install DMD in the /usr/local tree
- Steven Schveighoffer (4/6) Jan 25 2011 http://www.digitalmars.com/d/2.0/dmd-linux.html#dmd_conf
- Lars T. Kyllingstad (3/11) Jan 25 2011 Ah, thanks. I'll RTFM next time. ;)
- Jacob Carlborg (4/10) Jan 25 2011 Oh, /etc/ will be last, nice.
- Jacob Carlborg (15/40) Jan 25 2011 The plan is to have a version for Windows, the D code is written with a
- Vladimir Panteleev (7/9) Jan 25 2011 For what it's worth, I'm a FAR Manager user, and I've written myself a F...
- Jacob Carlborg (4/10) Jan 25 2011 I'll have a look at that.
- Andrej Mitrovic (2/2) Jan 25 2011 Personally I use Console2, and I've a hotkey to open a DMD session (it
- Jacob Carlborg (5/11) Jan 25 2011 I don't event recognize what language that is written in. Is that
- Andrej Mitrovic (1/1) Jan 25 2011 It's good old Pascal, much hated by C wizards. :D
- Jacob Carlborg (4/5) Jan 25 2011 Well, that explains, a lot :)
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (9/11) Jan 25 2011 Nitpick: it is more restricted than that. Platform is currently
- Jacob Carlborg (7/14) Jan 25 2011 Yeah, I guess you're right, didn't think there were a lot people who
- Lutger Blijdestijn (7/22) Jan 25 2011 I know it's possible to hit some pretty common subset that works in most...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (14/29) Jan 25 2011 Well, for other Bourne shells (like zsh or ksh), it will probably
- Jacob Carlborg (4/28) Jan 26 2011 Ok.
- Jesse Phillips (3/10) Jan 25 2011 To add to Lutger's message. I believe it is sh that is required by all P...
- Jacob Carlborg (4/14) Jan 26 2011 Ok. I'll see I can use only sh.
- Steven Schveighoffer (8/28) Jan 26 2011 FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave lik...
- Russel Winder (18/22) Jan 26 2011 =20
- Steven Schveighoffer (7/14) Jan 26 2011 On my ubuntu system too -- to my surprise ;)
- Jesse Phillips (2/3) Jan 26 2011 It is a new thing they did, about a release or two ago. The reason was b...
- Brad (9/14) Jan 26 2011 It was a system speed enhancement.
- Jacob Carlborg (8/38) Jan 26 2011 /bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh
- Steven Schveighoffer (9/44) Jan 26 2011 export => supported, but has a more limited syntax than bash
- Jacob Carlborg (4/52) Jan 26 2011 Ok, thanks.
- Nick Sabalausky (3/10) Jan 26 2011 Can't all (or most) of that be done in straight D?
- Jacob Carlborg (12/25) Jan 26 2011 It all comes done to one thing, the "source" function. If you launch an
- Michel Fortin (11/13) Jan 26 2011 But should it output this?
- Jacob Carlborg (5/14) Jan 27 2011 I have no idea. Perhaps it will run bash in a mode which is compatible
- Daniel Gibson (7/23) Jan 27 2011 Or just in normal mode, like linux distributions have been done for ages...
- Daniel Gibson (9/29) Jan 26 2011 Debian (and probably ubuntu as well) has a package called "devscripts" w...
- Jacob Carlborg (20/49) Jan 26 2011 On Mac OS X I use .bash_profile, I don't know if .profile and/or .bashrc...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (27/48) Jan 26 2011 er
- Jacob Carlborg (9/51) Jan 26 2011 Is it possible to detect what shell is running and then load the correct...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (31/66) Jan 27 2011 Since each shell sources a different file on startup, you can
- Jacob Carlborg (6/65) Jan 28 2011 I don't know actually. I'll have to test that.
I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only Posix -- /Jacob Carlborg
Jan 24 2011
"Jacob Carlborg" <doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 24 2011
Nick Sabalausky wrote:"Jacob Carlborg" <doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...FWIW, I just copy all the versions of dmd into olddmd/dmd2051, etc, and then use a trivial batch file. (Uses junction from sysinternals to make a symlink). --- junction c:\dmd c:\olddmd\dmd%1 > nul if not errorlevel 0 echo don't have version %1 --- eg, usedmd 2051I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 25 2011
On Tue, 25 Jan 2011 09:14:06 +0100, Don wrote:Nick Sabalausky wrote:Won't the script have to somehow set the import and library paths as well, so that DMD finds its corresponding druntime/phobos versions? -Lars"Jacob Carlborg" <doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...FWIW, I just copy all the versions of dmd into olddmd/dmd2051, etc, and then use a trivial batch file. (Uses junction from sysinternals to make a symlink). --- junction c:\dmd c:\olddmd\dmd%1 > nul if not errorlevel 0 echo don't have version %1 --- eg, usedmd 2051I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 25 2011
On Tue, 25 Jan 2011 03:22:22 -0500, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:On Tue, 25 Jan 2011 09:14:06 +0100, Don wrote:No, dmd uses the config file in the same directory as the exe. This config file contains those paths. -SteveNick Sabalausky wrote:Won't the script have to somehow set the import and library paths as well, so that DMD finds its corresponding druntime/phobos versions?"Jacob Carlborg" <doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...FWIW, I just copy all the versions of dmd into olddmd/dmd2051, etc, and then use a trivial batch file. (Uses junction from sysinternals to make a symlink). --- junction c:\dmd c:\olddmd\dmd%1 > nul if not errorlevel 0 echo don't have version %1 --- eg, usedmd 2051I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 25 2011
On Tue, 25 Jan 2011 08:22:40 -0500, Steven Schveighoffer wrote:On Tue, 25 Jan 2011 03:22:22 -0500, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Ah, forgot about dmd.conf. I always install DMD in the /usr/local tree and define DFLAGS as an environment variable. Does it look in the executable directory on Linux too? If so, does that take precedence over /etc/dmd.conf and environment variables? -LarsOn Tue, 25 Jan 2011 09:14:06 +0100, Don wrote:No, dmd uses the config file in the same directory as the exe. This config file contains those paths.Nick Sabalausky wrote:Won't the script have to somehow set the import and library paths as well, so that DMD finds its corresponding druntime/phobos versions?"Jacob Carlborg" <doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...FWIW, I just copy all the versions of dmd into olddmd/dmd2051, etc, and then use a trivial batch file. (Uses junction from sysinternals to make a symlink). --- junction c:\dmd c:\olddmd\dmd%1 > nul if not errorlevel 0 echo don't have version %1 --- eg, usedmd 2051I've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 25 2011
On Tue, 25 Jan 2011 08:32:42 -0500, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Does it look in the executable directory on Linux too? If so, does that take precedence over /etc/dmd.conf and environment variables?http://www.digitalmars.com/d/2.0/dmd-linux.html#dmd_conf -Steve
Jan 25 2011
On Tue, 25 Jan 2011 08:48:25 -0500, Steven Schveighoffer wrote:On Tue, 25 Jan 2011 08:32:42 -0500, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Ah, thanks. I'll RTFM next time. ;) -LarsDoes it look in the executable directory on Linux too? If so, does that take precedence over /etc/dmd.conf and environment variables?http://www.digitalmars.com/d/2.0/dmd-linux.html#dmd_conf
Jan 25 2011
On 2011-01-25 14:48, Steven Schveighoffer wrote:On Tue, 25 Jan 2011 08:32:42 -0500, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:Oh, /etc/ will be last, nice. -- /Jacob CarlborgDoes it look in the executable directory on Linux too? If so, does that take precedence over /etc/dmd.conf and environment variables?http://www.digitalmars.com/d/2.0/dmd-linux.html#dmd_conf -Steve
Jan 25 2011
On 2011-01-25 01:43, Nick Sabalausky wrote:"Jacob Carlborg"<doob me.com> wrote in message news:ihkvrr$1l02$1 digitalmars.com...The plan is to have a version for Windows, the D code is written with a Windows in mind. But the problem is the bash scripts, I'm not sure if a Windows version is possible. Bash scripting is vastly superior to batch scripting. For example, I don't know if there is any batch equivalent to the following in bash: * The "source" function/command * .bashrc/bash_profile In batch there is the "call" function but I don't know if it will retain any environment variables set by called the script. There exists a key (or what it's called) in the Windows register where you can add a path to a script that will be executed when the user logs in, opens cmd or something like that. -- /Jacob CarlborgI've created a tool that installs and manages D compilers and different versions. Description: DVM allows you to easily download and install D compilers and manage different versions of the compilers. When you switch D compiler with the "use" command the compiler will only be available in the current shell. This allows you to have one version of the compiler in one shell and another version in another shell. For example, have a D1 version in one shell and a D2 version in another. The tool is available at bitbucket: https://bitbucket.org/doob/dvm The wiki contains installation and usage instructions: https://bitbucket.org/doob/dvm/wiki/Home Platforms: currently only PosixYay! That sounds great! This is the second thing this week that I'd been intending to do and have been thrilled to be beaten to the punch :) You can bet I'll take a crack at porting it to windows...uhhh...assuming I can find the time...heh ;)
Jan 25 2011
On Tue, 25 Jan 2011 10:46:45 +0200, Jacob Carlborg <doob me.com> wrote:But the problem is the bash scripts, I'm not sure if a Windows version is possible.For what it's worth, I'm a FAR Manager user, and I've written myself a FAR plugin to solve this problem (and for other toolkits too): http://blog.thecybershadow.net/2010/04/02/envman-far-plugin-to-manage-your-environment/ -- Best regards, Vladimir mailto:vladimir thecybershadow.net
Jan 25 2011
On 2011-01-25 12:58, Vladimir Panteleev wrote:On Tue, 25 Jan 2011 10:46:45 +0200, Jacob Carlborg <doob me.com> wrote:I'll have a look at that. -- /Jacob CarlborgBut the problem is the bash scripts, I'm not sure if a Windows version is possible.For what it's worth, I'm a FAR Manager user, and I've written myself a FAR plugin to solve this problem (and for other toolkits too): http://blog.thecybershadow.net/2010/04/02/envman-far-plugin-to-manage-your-environment/
Jan 25 2011
Personally I use Console2, and I've a hotkey to open a DMD session (it just adds DMD to path really).
Jan 25 2011
On 2011-01-25 12:58, Vladimir Panteleev wrote:On Tue, 25 Jan 2011 10:46:45 +0200, Jacob Carlborg <doob me.com> wrote:I don't event recognize what language that is written in. Is that reading and writing to the registry? -- /Jacob CarlborgBut the problem is the bash scripts, I'm not sure if a Windows version is possible.For what it's worth, I'm a FAR Manager user, and I've written myself a FAR plugin to solve this problem (and for other toolkits too): http://blog.thecybershadow.net/2010/04/02/envman-far-plugin-to-manage-your-environment/
Jan 25 2011
It's good old Pascal, much hated by C wizards. :D
Jan 25 2011
On 2011-01-25 17:12, Andrej Mitrovic wrote:It's good old Pascal, much hated by C wizards. :DWell, that explains, a lot :) -- /Jacob Carlborg
Jan 25 2011
Jacob Carlborg wrote:Platforms: currently only Posix =20Nitpick: it is more restricted than that. Platform is currently only posix *with bash shell*. A lot of people use other shells, including non-Bourne shells (most frequent are zsh, ksh and tcsh). Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jan 25 2011
On 2011-01-25 20:33, "Jérôme M. Berger" 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 CarlborgPlatforms: currently only PosixNitpick: it is more restricted than that. Platform is currently only posix *with bash shell*. A lot of people use other shells, including non-Bourne shells (most frequent are zsh, ksh and tcsh). Jerome
Jan 25 2011
Jacob Carlborg wrote:On 2011-01-25 20:33, "Jérôme M. Berger" wrote:I know it's possible to hit some pretty common subset that works in most shells, though I don't have any experience. There is a posix specification for shells, bash is supposed to follow that if ran as sh: http://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html There are entire books an the subject, this is a nice small article about the common stuff: http://www.linux.com/archive/feature/34658Jacob 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?Platforms: currently only PosixNitpick: it is more restricted than that. Platform is currently only posix *with bash shell*. A lot of people use other shells, including non-Bourne shells (most frequent are zsh, ksh and tcsh). Jerome
Jan 25 2011
Jacob Carlborg wrote:On 2011-01-25 20:33, "J=C3=A9r=C3=B4me M. Berger" wrote:dJacob Carlborg wrote:=20 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 an=Platforms: currently only PosixNitpick: it is more restricted than that. Platform is currently only posix *with bash shell*. A lot of people use other shells, including non-Bourne shells (most frequent are zsh, ksh and tcsh). Jeromeeven less about non-bourne shells, will it be possible to port to other=shells? How much do they differ? =20Well, for other Bourne shells (like zsh or ksh), it will probably mostly be a question of putting the initialization code in the right file (i.e. .zshrc or .kshrc). Other than that, unless you are doing something pretty fancy, the same code should work. For C-shells (like tcsh) the syntax is pretty different, so it will probably require more changes. However, it has been a while since I last used tcsh, so I cannot tell you how much work it would be. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jan 25 2011
On 2011-01-25 23:30, "Jérôme M. Berger" wrote:Jacob Carlborg wrote:Ok. -- /Jacob CarlborgOn 2011-01-25 20:33, "Jérôme M. Berger" wrote:Well, for other Bourne shells (like zsh or ksh), it will probably mostly be a question of putting the initialization code in the right file (i.e. .zshrc or .kshrc). Other than that, unless you are doing something pretty fancy, the same code should work. For C-shells (like tcsh) the syntax is pretty different, so it will probably require more changes. However, it has been a while since I last used tcsh, so I cannot tell you how much work it would be. JeromeJacob 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?Platforms: currently only PosixNitpick: it is more restricted than that. Platform is currently only posix *with bash shell*. A lot of people use other shells, including non-Bourne shells (most frequent are zsh, ksh and tcsh). Jerome
Jan 26 2011
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 CarlborgTo 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...
Jan 25 2011
On 2011-01-25 23:59, Jesse Phillips wrote:Jacob Carlborg Wrote:Ok. I'll see I can use only sh. -- /Jacob CarlborgYeah, 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 CarlborgTo 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...
Jan 26 2011
On Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg <doob me.com> wrote:On 2011-01-25 23:59, Jesse Phillips wrote:FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like the original Bourne Shell. I typically find /bin/sh features to be enough for implementing most scripts. A good reference (if you don't have it) is Unix in a nutshell, probably my most used textbook. -SteveJacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...
Jan 26 2011
On Wed, 2011-01-26 at 08:58 -0500, Steven Schveighoffer wrote: [ . . . ]FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like==20the original Bourne Shell.For some definition of "usually". On Debian and Ubuntu /bin/sh is a symbolic link to dash not bash.I typically find /bin/sh features to be enough for implementing most =20 scripts.And the only guaranteed portable script -- assuming Windows without Cygwin or MSYS is excluded ! [ . . . ] --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jan 26 2011
On Wed, 26 Jan 2011 10:50:20 -0500, Russel Winder <russel russel.org.uk> wrote:On Wed, 2011-01-26 at 08:58 -0500, Steven Schveighoffer wrote: [ . . . ]On my ubuntu system too -- to my surprise ;) On my fedora system I think it was symlinked to bash. Either way, the actual "bourne shell" is rarely installed on Linux, it's usually another shell that mimics the features. -SteveFWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like the original Bourne Shell.For some definition of "usually". On Debian and Ubuntu /bin/sh is a symbolic link to dash not bash.
Jan 26 2011
Steven Schveighoffer Wrote:On my ubuntu system too -- to my surprise ;)It is a new thing they did, about a release or two ago. The reason was because /bin/sh pointed to bash and _did not_ adhere to the sh standard.
Jan 26 2011
On 2011-01-26, Jesse Phillips <jessekphillips+D gmail.com> wrote:Steven Schveighoffer Wrote:It was a system speed enhancement. Much of the bootup speed gain was due to switching to dash. bash is slow. bash adhere's to sh standards is just fine except that it won't flag extensions, so you can still end up with bashisms in your shell script. I've never had any issues w/bash. I write shell scripts that run in bash2, bash3, bash4, ash, dash, ksh88, ksh93, mksh, SunOS sh, Tru64 sh, AIX sh, HP-UX sh.On my ubuntu system too -- to my surprise ;)It is a new thing they did, about a release or two ago. The reason was because /bin/sh pointed to bash and _did not_ adhere to the sh standard.
Jan 26 2011
On 2011-01-26 14:58, Steven Schveighoffer wrote:On Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg <doob me.com> wrote:/bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.On 2011-01-25 23:59, Jesse Phillips wrote:FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like the original Bourne Shell.Jacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...I typically find /bin/sh features to be enough for implementing most scripts.I have no idea. I need to be able use the following commands/functions: export, source, builtin hash, rm, echo, exit, execA good reference (if you don't have it) is Unix in a nutshell, probably my most used textbook.Ok, I'll have a look.-Steve-- /Jacob Carlborg
Jan 26 2011
On Wed, 26 Jan 2011 15:24:56 -0500, Jacob Carlborg <doob me.com> wrote:On 2011-01-26 14:58, Steven Schveighoffer wrote:Yes, it should limit you to /bin/sh supported commandsOn Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg <doob me.com> wrote:/bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.On 2011-01-25 23:59, Jesse Phillips wrote:FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like the original Bourne Shell.Jacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...export => supported, but has a more limited syntax than bash source => supported via . builtin hash => supported rm => command (shell independent) exit => supported exec => supported -SteveI typically find /bin/sh features to be enough for implementing most scripts.I have no idea. I need to be able use the following commands/functions: export, source, builtin hash, rm, echo, exit, exec
Jan 26 2011
On 2011-01-26 21:47, Steven Schveighoffer wrote:On Wed, 26 Jan 2011 15:24:56 -0500, Jacob Carlborg <doob me.com> wrote:Ok, thanks. -- /Jacob CarlborgOn 2011-01-26 14:58, Steven Schveighoffer wrote:Yes, it should limit you to /bin/sh supported commandsOn Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg <doob me.com> wrote:/bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.On 2011-01-25 23:59, Jesse Phillips wrote:FWIW, /bin/sh is usually a symlink to bash, and it makes bash behave like the original Bourne Shell.Jacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...export => supported, but has a more limited syntax than bash source => supported via . builtin hash => supported rm => command (shell independent) exit => supported exec => supported -SteveI typically find /bin/sh features to be enough for implementing most scripts.I have no idea. I need to be able use the following commands/functions: export, source, builtin hash, rm, echo, exit, exec
Jan 26 2011
"Jacob Carlborg" <doob me.com> wrote in message news:ihq02n$28ki$1 digitalmars.com...On 2011-01-26 14:58, Steven Schveighoffer wrote:Can't all (or most) of that be done in straight D?On Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg <doob me.com> wrote: I typically find /bin/sh features to be enough for implementing most scripts.I have no idea. I need to be able use the following commands/functions: export, source, builtin hash, rm, echo, exit, exec
Jan 26 2011
On 2011-01-26 21:53, Nick Sabalausky wrote:"Jacob Carlborg"<doob me.com> wrote in message news:ihq02n$28ki$1 digitalmars.com...It all comes done to one thing, the "source" function. If you launch an application in a shell that application can't set environment variables that will be available to the shell when the application exits. So instead I have most of the application written in D with a bash function that wraps the application. It works like this: 1. The function calls the D application 2. The D application performs all it needs to and writes a shell script to a file 3. The bash function calls "source" with this file as a parameter -- /Jacob CarlborgOn 2011-01-26 14:58, Steven Schveighoffer wrote:Can't all (or most) of that be done in straight D?On Wed, 26 Jan 2011 03:36:24 -0500, Jacob Carlborg<doob me.com> wrote: I typically find /bin/sh features to be enough for implementing most scripts.I have no idea. I need to be able use the following commands/functions: export, source, builtin hash, rm, echo, exit, exec
Jan 26 2011
On 2011-01-26 15:24:56 -0500, Jacob Carlborg <doob me.com> said:/bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.But should it output this? $ /bin/sh --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc. $ This is on Mac OS X 10.6.6. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Jan 26 2011
On 2011-01-26 23:46, Michel Fortin wrote:On 2011-01-26 15:24:56 -0500, Jacob Carlborg <doob me.com> said:I have no idea. Perhaps it will run bash in a mode which is compatible with sh. -- /Jacob Carlborg/bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.But should it output this? $ /bin/sh --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc. $ This is on Mac OS X 10.6.6.
Jan 27 2011
Am 27.01.2011 13:05, schrieb Jacob Carlborg:On 2011-01-26 23:46, Michel Fortin wrote:Or just in normal mode, like linux distributions have been done for ages (and some still do). bash *is* compatible with sh (=> everything that runs in sh runs in bash), but sh is not compatible with bash (=> bash has features that other sh-compliant shells don't have and that are not required by the corresponding POSIX standard).On 2011-01-26 15:24:56 -0500, Jacob Carlborg <doob me.com> said:I have no idea. Perhaps it will run bash in a mode which is compatible with sh./bin/sh is not a symlink on Mac OS X. I guess I just can try to use sh instead of bash.But should it output this? $ /bin/sh --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc. $ This is on Mac OS X 10.6.6.
Jan 27 2011
Am 26.01.2011 09:36, schrieb Jacob Carlborg:On 2011-01-25 23:59, Jesse Phillips wrote: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. 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. Cheers, - DanielJacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...
Jan 26 2011
On 2011-01-26 19:12, Daniel Gibson wrote:Am 26.01.2011 09:36, schrieb Jacob Carlborg:That sounds like something I could use.On 2011-01-25 23:59, Jesse Phillips wrote: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.Jacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...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
Jan 26 2011
Jacob Carlborg wrote:On 2011-01-25 23:59, Jesse Phillips wrote:andJacob 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 =ereven less about non-bourne shells, will it be possible to port to oth=shells? How much do they differ? --=20 /Jacob CarlborgTo 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=You cannot. You need to modify the environment for the current shell, which is the shell that the user is currently using (no matter what else may or may not be installed on the system). This has two consequences: - You need to have some code that is run when the shell starts (i.e. from .bashrc, .zshrc or .kshrc). That code will define the proper aliases and/or functions (at the time being, this is mostly the "dvm" function in "dvm.sh" (*)). This can be accomplished by having a different version of this file for each shell; - You need to generate the contents of $dvm_result_path in a format that the shell will understand. The easiest way to do that is probably to define a few extra functions in "dvm.sh" to enable setting environment variables in a portable way and handle additional requirements (like "builtin hash -r" which is definitely a bash-ism). Then generate the $dvm_result_path using these functions instead of the normal shell syntax. Jerome (*) BTW, I hope you do not add the full contents of dvm.sh nor a "source dvm.sh" in .bashrc the way it is now. Otherwise, a misconfiguration may prevent the user from starting a shell! --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.frhas started pointing /bin/sh to dash which is complaint with posix...=20 Ok. I'll see I can use only sh. =20
Jan 26 2011
On 2011-01-26 21:04, "Jérôme M. Berger" wrote:Jacob Carlborg wrote:Is it possible to detect what shell is running and then load the correct version?On 2011-01-25 23:59, Jesse Phillips wrote:You cannot. You need to modify the environment for the current shell, which is the shell that the user is currently using (no matter what else may or may not be installed on the system). This has two consequences: - You need to have some code that is run when the shell starts (i.e. from .bashrc, .zshrc or .kshrc). That code will define the proper aliases and/or functions (at the time being, this is mostly the "dvm" function in "dvm.sh" (*)). This can be accomplished by having a different version of this file for each shell;Jacob Carlborg Wrote:Ok. I'll see I can use only sh.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 CarlborgTo 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...- You need to generate the contents of $dvm_result_path in a format that the shell will understand. The easiest way to do that is probably to define a few extra functions in "dvm.sh" to enable setting environment variables in a portable way and handle additional requirements (like "builtin hash -r" which is definitely a bash-ism). Then generate the $dvm_result_path using these functions instead of the normal shell syntax.The contents of $dvm_result_path will only export one variable.Jerome (*) BTW, I hope you do not add the full contents of dvm.sh nor a "source dvm.sh" in .bashrc the way it is now. Otherwise, a misconfiguration may prevent the user from starting a shell!OK, how else can I do the same thing? BTW this is how RVM (Ruby Version Manager) works, where I got the idea from. The whole RVM is written in shell script and it's sourced in .bashrc. -- /Jacob Carlborg
Jan 26 2011
Jacob Carlborg wrote:On 2011-01-26 21:04, "J=C3=A9r=C3=B4me M. Berger" wrote:tYou cannot. You need to modify the environment for the current shell, which is the shell that the user is currently using (no matter what else may or may not be installed on the system). This has two consequences: - You need to have some code that is run when the shell starts (i.e. from .bashrc, .zshrc or .kshrc). That code will define the proper aliases and/or functions (at the time being, this is mostly the "dvm" function in "dvm.sh" (*)). This can be accomplished by having a different version of this file for each shell;=20 Is it possible to detect what shell is running and then load the correc=version? =20Since each shell sources a different file on startup, you can source the correct version from the startup file. On installation, the SHELL environment variable should tell you which shell is used.Do not you need to call "builtin hash -r" each time you change the path (I do not know since I am not a bash user)? If not, why do you need to call it in __dvm_setup_environment?- You need to generate the contents of $dvm_result_path in a format that the shell will understand. The easiest way to do that is probably to define a few extra functions in "dvm.sh" to enable setting environment variables in a portable way and handle additional requirements (like "builtin hash -r" which is definitely a bash-ism). Then generate the $dvm_result_path using these functions instead of the normal shell syntax.=20 The contents of $dvm_result_path will only export one variable. =20Jerome (*) BTW, I hope you do not add the full contents of dvm.sh nor a "source dvm.sh" in .bashrc the way it is now. Otherwise, a misconfiguration may prevent the user from starting a shell!=20 OK, how else can I do the same thing? BTW this is how RVM (Ruby Version=Manager) works, where I got the idea from. The whole RVM is written in shell script and it's sourced in .bashrc. =20Remove the call to exit and wrap the rest of the file in a "if [[ ! -z "$dvm_prefix" ]] ; then ..." So the file will look like: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D8<------------------------------ if [[ -z "$dvm_prefix" ]] ; then if [[ -n "$HOME" ]] ; then dvm_prefix=3D"$HOME/." else echo "No \$dvm_prefix was provided and " echo "$(id | \sed -e's/^[^(]*(//' -e 's/).*//') has no \$HOME defined." fi fi if [[ ! -z "$dvm_prefix" ]] ; then ... fi ------------------------------>8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jan 27 2011
On 2011-01-27 23:34, "Jérôme M. Berger" wrote:Jacob Carlborg wrote:Ah, right. Didn't think of that.On 2011-01-26 21:04, "Jérôme M. Berger" wrote:Since each shell sources a different file on startup, you can source the correct version from the startup file. On installation, the SHELL environment variable should tell you which shell is used.You cannot. You need to modify the environment for the current shell, which is the shell that the user is currently using (no matter what else may or may not be installed on the system). This has two consequences: - You need to have some code that is run when the shell starts (i.e. from .bashrc, .zshrc or .kshrc). That code will define the proper aliases and/or functions (at the time being, this is mostly the "dvm" function in "dvm.sh" (*)). This can be accomplished by having a different version of this file for each shell;Is it possible to detect what shell is running and then load the correct version?I don't know actually. I'll have to test that.Do not you need to call "builtin hash -r" each time you change the path (I do not know since I am not a bash user)? If not, why do you need to call it in __dvm_setup_environment?- You need to generate the contents of $dvm_result_path in a format that the shell will understand. The easiest way to do that is probably to define a few extra functions in "dvm.sh" to enable setting environment variables in a portable way and handle additional requirements (like "builtin hash -r" which is definitely a bash-ism). Then generate the $dvm_result_path using these functions instead of the normal shell syntax.The contents of $dvm_result_path will only export one variable.Yeah, I kind of notice that. The "exit" didn't work out that well. -- /Jacob CarlborgRemove the call to exit and wrap the rest of the file in a "if [[ ! -z "$dvm_prefix" ]] ; then ..." So the file will look like: ==============================8<------------------------------ if [[ -z "$dvm_prefix" ]] ; then if [[ -n "$HOME" ]] ; then dvm_prefix="$HOME/." else echo "No \$dvm_prefix was provided and " echo "$(id | \sed -e's/^[^(]*(//' -e 's/).*//') has no \$HOME defined." fi fi if [[ ! -z "$dvm_prefix" ]] ; then ... fi ------------------------------>8============================== JeromeJerome (*) BTW, I hope you do not add the full contents of dvm.sh nor a "source dvm.sh" in .bashrc the way it is now. Otherwise, a misconfiguration may prevent the user from starting a shell!OK, how else can I do the same thing? BTW this is how RVM (Ruby Version Manager) works, where I got the idea from. The whole RVM is written in shell script and it's sourced in .bashrc.
Jan 28 2011