JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for CCP4BB Archives


CCP4BB Archives

CCP4BB Archives


CCP4BB@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CCP4BB Home

CCP4BB Home

CCP4BB  March 2008

CCP4BB March 2008

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: problems about installation of mosflm701

From:

Ian Tickle <[log in to unmask]>

Reply-To:

Ian Tickle <[log in to unmask]>

Date:

Thu, 27 Mar 2008 10:58:57 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (62 lines)

> You would also need to change the top line of the file so 
> that it was something like "#!/bin/bash -f", though I would 
> be more inclined to use a proper traditional Bourne shell for 
> this and use "#!/bin/sh -f" and use "set"s and "export"s throughout.

That's not actually necessary for a 'sourced' script because 'source'
reads it as a text file, not as an executable script, i.e. all you are
doing is temporarily switching input for the *current* shell from the
terminal to the file and back again.  So the first line, whatever it is,
if it begins with '#' it will be treated as a comment (that's why the
'#' is put there!).  In contrast, *running* a shell script starts a
*new* (child) shell (which need not be the same shell as the parent
shell).  If you start it like so: 'shell script_name' the shell
specified on the command line is used and any shell specification inside
the script is ignored; whereas if you start it like so: 'script_name'
(in which case it must be made executable first otherwise you will get
'permission denied'), then the shell specified by the first line
'#!shell' is used (if the first line is not in this format it uses
/bin/sh and the line is treated as a normal shell command).  For a
script which is intended to set up the environment for other programs
(e.g. CCP4) it's essential to source the file so that the commands in
the file modify the environment of the current shell from which you will
launch the programs.  If you run it in a child shell the environment set
up for the child process is *not* passed back to the parent shell, so it
will have absolutely no effect.

I often see people *running* programs (i.e. not just setting up the
environment) by sourcing a script, i.e. the script contains commands for
running programs: I always think that's a dangerous thing to do because
anything in the file which changes the environment will change the
environment for the terminal shell you are using, with unpredictable
consequences for things you type in later.  If I do that accidentally I
always immediately terminate the terminal shell and start a new one so
that the shell is in a known state, just to be on the safe side.  It's
always safer to *run* programs with a shell script using 'shell
script_name' or 'script_name' so then the script is completely isolated
from the terminal shell.
 
> If you really want to run the script, I would use tcsh or 
> csh, rather than trying to modify it so that it is a bash script.

That's all very well but people use other shells for their terminal
sessions for other reasons (e.g. csh/tcsh isn't guaranteed to be
portable, or the user may already have setup scripts for their current
shell which they don't want to rewrite).  As indicated above the
commands used in a 'sourced' script must correspond to the terminal
shell, since it is that environment you want to modify: any shell
specification inside the script is ignored, e.g. if you want to use bash
for your terminal shell (many people do!) then the sourced file *must*
contain bash commands, there's no way around it (this is why CCP4
supplies versions of the setup script for both sh and csh).

Cheers

-- Ian


Disclaimer
This communication is confidential and may contain privileged information intended solely for the named addressee(s). It may not be used or disclosed except for the purpose for which it has been sent. If you are not the intended recipient you must not review, use, disclose, copy, distribute or take any action in reliance upon it. If you have received this communication in error, please notify Astex Therapeutics Ltd by emailing [log in to unmask] and destroy all copies of the message and any attached documents. 
Astex Therapeutics Ltd monitors, controls and protects all its messaging traffic in compliance with its corporate email policy. The Company accepts no liability or responsibility for any onward transmission or use of emails and attachments having left the Astex Therapeutics domain.  Unless expressly stated, opinions in this message are those of the individual sender and not of Astex Therapeutics Ltd. The recipient should check this email and any attachments for the presence of computer viruses. Astex Therapeutics Ltd accepts no liability for damage caused by any virus transmitted by this email. E-mail is susceptible to data corruption, interception, unauthorized amendment, and tampering, Astex Therapeutics Ltd only send and receive e-mails on the basis that the Company is not liable for any such alteration or any consequences thereof.
Astex Therapeutics Ltd., Registered in England at 436 Cambridge Science Park, Cambridge CB4 0QA under number 3751674

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager