Bash scripting: Source and export

A key issue we encountered in batch scripting our analyses was how to make variables that are defined in one script available for another. 

Two ways of manipulating which scripts can access which variables are by changing from using 'sh' to 'source' when calling a script, or by using 'export' when defining a variable. 

The 'source' command can be used instead of the sh command to call scripts.  Sourcing a script essentially runs the text in the sourced script as if it had been copied and pasted into the calling script.  Variables that are defined within the sourced script are therefore available within the script that calls them.  Note that variables defined in this manner will not be available within the shell once your script has run.

In contrast, when variables are defined with the 'export' command, they are made available to all processes you run within that shell (terminal).

This is relevant for MRI analyses when you use a shell script to batch analyses. You may want to define images in one script (e.g., raw MPRage, T2, EPI runs etc.), then use and alter them (and define other variables) in subsequent scripts.  While this could be done using the 'export' command, once you begin batching multiple subjects you may end up with cases where data defined for a prior patient is carried to subsequent patient analyses.

This can be addressed by using the 'source' command (and not exporting variables), and controlling the availability of variables within nested 'job', 'setup' and 'task' scripts.

By running your subject's analysis in a separate process (job.sh) and not using export, you can contain all defined variables exclusively within that (job) process, and they are effectively cleared when job.sh is called for the next patient to be run.

# Script 1: batch.sh
# This script does not have access to variables within the job.sh script/process.
# Variables defined in this script are available, however, to the job.sh process.

for cases in SUB1 SUB2 SUB3 ; do
   sh job.sh

# Script 2: job.sh
# All variables defined in setup.sh are available to all other called scripts,
# but are effectively cleared once this script ends.
# This script must be called with 'sh' to start a new process.

source setup.sh.   #Script defining key variables (T1, T2, EPI runs etc.)
source task1.sh.    #Script running skull-stripping
source task2.sh.   #Script running analyses


Moving from Australia to the US to work as a research neuropsychologist/neuroscientist

Note: There is now a google group for Australian (neuro)psychologists looking to work overseas, here.

If you want to work as a researcher in the neurosciences in the US, and you have trained in Australia, it’s pretty straightforward if you are happy to work as a postdoc. From what I know from training at University of Melbourne and seeing the degrees at Monash, Latrobe and (previously) Victoria Uni the training in Australia is at least world class.  This is all based on the experience of one individual, and will continually change, so be warned, and if you have any advice or suggested edits I'd be grateful if you emailed.

Your salary will typically be in the low 40s, which is enough to live on in the US (and well, well above what many people live on), and it may be $47,462 pending a recent legal increase (in the last months of Barack Obama's tenure as President) if you are not paid separately for overtime (you can read about this here). Visa information is covered at the bottom of the page on getting licensed clinically in the US. As in Australia, working as a researcher in the US long term has less-than-perfect job security. Your goal of course is to work up to a Professor in the long-term. You’ll find it easier to get a job here than in Australia (and it’s really great living here), but you will most likely be paid less than in Aus. Note that as a foreign national you will mostly be supported by and compete for institutional funding and private foundation funds, unless you get a green card. This is because foreign nationals are not eligible for the key NIH early-career grants (K awards, except for the K99/R01). Don’t let this deter you if you want to come over for research-it can work out, and it’s a lot of fun-but know that you’ll need to work hard. One tip – Californian postdocs are paid more than postdocs in most other states, at least in the UC system. This is because the postdocs unionized and so there is a standard pay scale (see some debate here and here if you’re interested). In Boston, in my limited experience, the hospitals were clearly trying to decrease chances for the postdocs to unionize as it would raise institutions’ costs. 

After you’ve been a postdoc for a year or two you might become an Instructor (salary usually 50-60k), then ideally an Assistant Professor. Salaries here vary widely, but in your first year they’re typically 75-90k+, and up to 110 for particularly good institutions if you are a star (according to some friends who are). You should also get a startup package for your lab. Salaries for federally-funded public universities are open, so google the university you are interested in and “salaries” or “pay” and you should be able to see what the range is for people at that institution. Private universities don’t list their salaries, and as a rule they pay more. As such you can take a salary from an equivalent public university as a lower bound in negotiating if negotiation is appropriate.

Note: written/first posted in 2014.

Where to find jobs in the US in neuropsychology and neuroscience

Note: There is now a google group for Australian (neuro)psychologists looking to work overseas, here.

If you are hunting for a clinical or research position as a neuropsych or neuroscientist in the US, these are some useful sources. There are many others out there; if you have any advice or suggested edits I'd be grateful if you emailed.



  • Contact people you want to work with directly, or speak with them at conferences.  At conferences, head to the job message boards.
  • Cognitive Neuroscience Society newsletter.  This is outstanding – comes out monthly, many positions are listed.

If you are in neuroimaging, you will probably already know this, but

How to become a neuropsychologist in the US if you have trained Overseas, in Australia

Note: There is now a google group for Australian (neuro)psychologists looking to work overseas, here.

This has been updated on Oct 23, 2014 after a presentation on this topic at Monash University.  Slides for the talk are here.  A diagram outlining how you become a psychologist, and a neuropsychologist, in the US (from the talk) is here.  If you have any advice on edits I'd be very grateful if you emailed.

The following is a broad overview of how to look at the possibilities for working in the US clinically if you’ve completed or are completing your psych training in Australia.  It’s a lot of fun in the US; there are great positions, there are more positions than are posted in Australia, and the academic community is big.  There are many great, interesting people who know what you are doing.  Also, because you have already specialized in neuropsychology during your PhD/PsyD – not typically done in the US – you will likely know more about your area of specialty than others completing their PhD/PsyDs in the US.  The trade off is that if you haven’t done so much clinical psych, you’ll know less about this – doctoral students in the US do extensive clin psych training during their graduate study. As a follow up to this post I’ve added some links to where you can find jobs in the US.
Disclaimer: All of this is based on one Australian (neuro)psych’s experience in the US over two research fellowships and one clinical neuropsych postdoc. It is possible to transition (I’m licensed in Australia–non-practicing while overseas–and Connecticut), and the following is what I’ve learned and remember from over five years of speaking with various US psych boards as well as some false starts (e.g, applying for the internship match, which was unnecessary). It’s possible there may be errors in the below, though I’ve done my best to ensure it’s correct. I have not contacted every state board, so there may be some state’s whose training requirements differ from the general framework for training described below.  Remember as you approach things that a key mission of licensing boards is to protect the public, they are understandably cautious in licensing foreign clinicians, and there will be a large number of hoops to jump through so that you can give them confidence that your training and standard of practice is equivalent to an individual whose training they already understand.

The summary of this post is: if you have a PhD or PsyD from a major public university in Australia (e.g., Melbourne, Monash, Latrobe), to get licensed to work clinically in the US you will most likely need to (a) do a two year neuro postdoc in the US where you will earn around $40k/annum; and while you are doing this (b) apply for licensure in the US state you want to work in; and (c) during the second year, sit for a licensing exam and maybe a minor state law exam. Your degree will almost certainly be considered equivalent to a US PhD or PsyD. In the second year of your postdoc you’ll apply for jobs, and your options will include a purely clinical or clinical/research position (salary anything from ~$75k-110k) or private work ($100+ after you build your practice up, less if you join someone else’s practice). Pediatric work is in demand. Note living costs are lower. Read on for more detail.

Can I get my Australian license recognized/recognised in the US?

The first question you probably have is: can I get my license from Australia recognized in the US?  In my experience the answer is: No.  While you can get your degree recognized towards registration (aka licensure in the US), if you apply to work in the US, the states I have spoken to (including California, Connecticut) will not recognize registration with AHPRA as being equivalent to licensure with a regulatory board in the US.

The reason is that although you can get your PhD recognized as equivalent to a US PhD, you have not had clinical training completed under the supervision of a US-licensed, or ideally American Psychological Association (APA) accredited, psychologist, and you have not completed the licensing exam (EPPP, below).  While this is completely understandable – how does the board know that what psychologists do in Australia is what psychologists do in the US – it is frustrating.  To be really sure this is correct for the state you are interested in, directly contact their licensing board. While it is unlikely, there may be one or two states that I haven’t looked into–i.e., other than CA, MA, AZ, DC, MD, CT, NY–where you can get your Australian licensure recognized.

Can I contact a single representative body to get licensed? 

Like Australia until recently, each state independently manages licensure of its psychologists.  Massachusetts is typically understood to be the hardest state to get licensed in in, followed by California.  In my experience, with a combined M.Psy. (Neuro)/PhD from Melbourne Uni, the process in California was relatively smooth (and they have a very helpful board).  Check their page out here.  Separate to licensure, you can later get “board certified” in clinical neuropsychology, though this is an optional gold standard – you can still work in the field of neuropsychology if you are licensed as a psychologist.

How can I get licensed to practice as a psychologist in the US?

You need (1) a doctorate (PhD or PsyD), (2) two years of clinical supervision under a US-licensed/APA accredited psychologist, and to (3) sit for the psychology licensing exam (EPPP). You may also need to sit a minor state exam to show you know the relevant laws.

Emphasizing the fact that regulations vary and you must contact the board in the state where you want to apply, it appears two states – Vermont and West Virginia – may accept a Master’s degree rather than doctorate, though note this is unusual.

1. Doctoral training in psychology

If you have a doctorate (PhD, PsyD) in Australia, it is very likely that your degree is substantially equivalent to a US degree and that you should be able to get this recognized.

States generally require you to have done a PhD or PsyD in the field.  If you have a PhD or PsyD, this is likely to be considered equivalent or almost equivalent to a US PhD or PsyD.  You may, however, have to do some additional courses in areas of particular importance in the state you are interested in – e.g., cultural diversity – to get licensed. If your PhD is in related but different field (e.g., cognitive neuroscience), or did not involve supervised clinical placements (referred to as an internship in the US) and a thesis (referred to as a dissertation in the US), you may have difficulties.

In some states all they will request is an evaluation (e.g., from WES, below) that shows them that your degree is equivalent to a US doctoral degree (PhD, PsyD) in psychology, and they will accept this as evidence you’ve completed sufficient training.  In others you will need this and/or a formal statement from your course director (“Director of Clinical Training”) that states how your PhD coursework fits with their state’s regulations.

How do I really know if my degree is considered equivalent to a doctoral degree for the purposes of licensure?

The state you want to get licensed in will almost certainly ask you to verify your degree by one of a series of official organizations.  Which organization you use will depend on which state you are going to get licensed in.  A good one required by many states is World Education Services (WES) out of NYC.  Getting them to review your credentials requires you to have your Australian institution send your transcript directly to them.  Choose the option to “bank” your credentials; you may later need to send this report to potential employers or the organization evaluating you for Board Certification.  Cost is around $200-300USD all up, from memory.  Many states (e.g., California, Connecticut) will accept a WES evaluation to indicate degree equivalence for licensure.  Some other states will accept an evaluation from the National Register (for instance, DC).  The National Register is a great idea – they review and bank your credentials for future use – and they are tailored specifically for review of psychology credentials (WES is for any field).  Because the register considers the honors year that Australian Psychologists much complete towards their postdoctoral training when they consider your postgraduate psychology experience and makes this clear to people reading the document this looks like a better option, though not all states will accept it.  The cost is higher (I think around $500, check their website).

Do not spend any money or get anything done until you have contacted the state you want to get licensed in and asked them how they will evaluate your credentials.  This is because while nearly every state will require a formal evaluation of your degree, in my experience for some states, e.g. Arizona, they will not require this and you may simply need to list for them how your doctoral experience meets their state’s requirements.  This may simply be describing how you have had doctoral training of at least four hours in each of a number of areas (e.g., history of psychology; cognitive psychology; biological bases of behavior etc.).

Is there a single, common set of criteria for what constitutes a doctoral degree in psychology?

There is some consensus about what constitutes a doctoral degree per the ASPPB/National Register Designation Project.  My understanding is that in the early 1980s there was a lot of variation between doctoral programs and that this project was started to try and codify what clinicians required in terms of academic training to be able to practice.  As an aside, the use of its criteria is now so widespread, in 2013 the project formally stated that it will actually stop evaluating training programs in December 2019.  For Australians, you can compare your training against these criteria to see how close your training is to that which an American doctoral student goes through and how likely you are to have to take additional training in a given area.

Even better – compare your training to these regulations as stated in the regulations of the state you want to apply to.  I say this because many states will modify these criteria, though typically only slightly.  For instance, California will want your degree to fulfill these criteria then also require you to get specific training in identifying elder abuse and a few other areas. Most of the time it’s easy to get this additional training – you can do it online, relatively inexpensively, and you’ll get a certificate to verify that you have completed it. The good thing is that education in Australia is generally of a very high quality and your degree really is likely to meet the US states’ criteria, though the state will probably be skeptical simply because they are (understandably) unfamiliar with most foreign degrees.

2. Clinical experience

The next thing you will need is two years of supervised clinical experience.  This is the area where an Australian clinician will likely have difficulty: boards typically want clinicians to have trained under a US-licensed psychologist.  My experience is clinical work under Australian psychologists therefore does not count.

Can I use my year+ of placements completed in Australia?

Your year+ of placements was essential even in the US – your doctoral program would not be considered equivalent if you didn’t do this – but it will most likely not count towards licensure because you were not under a US-licensed clinician.  Again, (sorry to do this), there may be a state that will recognize your experience, though I have not found one.  Email or call the licensing board to check.  As an aside, if you later want to get board-certified I was informed by the board that you can use your hours from Australia towards this.

Additionally, the fact that you do have experience means that many (two year) clinical postdoctoral fellowship programs will recognize your experience. This allows you to get your two years’ experience through your postdoctoral training.

Can I use my clinical experience that I’ve gained in Australia-while registered-towards licensure?

Unfortunately not as, again, you need to be supervised by an APA-accredited (ideally) or at least US-licensed psychologist. This experience will be very helpful in your application for a postdoctoral clinical fellowship though, because it will be clear how much experience you already have.

How long is a year of clinical experience?

Usually around 1600-1800hrs, though you can need to find the exact number of hours required by hitting the licensing board website for the state you want to get licensed in.  They may also require specific statements about how many hours of face to face supervision you had, how many hours direct patient contact you had, etc.

Out of interest, how have people in the US gained this experience?

In the US, people have usually done their 1 year of supervised clinical training during their PhD as a year-long near full-time paid ‘internship’.  They do this in the final year of their phd (the fifth year); they try to submit their thesis (referred to as dissertation) by the end of the fourth year.  The equivalent in Australia is the series of placements most institutions require completed in different contexts (e.g., rehabilitation, pediatric, acute etc.).  Separately, in the US people also complete unpaid ‘externships’ in the early years of the phd.  These are like mini-placements that run for 8-9 months and require 1-3 days attendance each week at a given site.  If you have done e.g. time working with a telephone crisis line in Australia, you could refer to this as an externship.

In the US, doctoral students go through the internship Match process.  You do not have to worry about this, which is great, because it is brutal.  Because the education system in the US is run aggressively for profit in a way that it is not in Australia, there are now many PsyD programs and many many more people wanting internships than there are internship positions.  Because of this the competition for internships is tremendous (many hundreds of trainees do not place each year) and PsyDs are, unfortunately, not as highly regarded as PhDs. Again – luckily you don’t have to worry about this because you will not be doing an internship. Note that competition in the postdoctoral match is not as strong.

How can I get this experience?

You can acquire this two years of experience in the US to help you get licensed by doing a two-year postdoc in clinical neuropsychology.

How can I find out how to do this?

  1. You can go through the APPCN’s postdoctoral “Match” process.  There is also a list of postdoctoral fellowships maintained by APPIC.   Applications fall due from November through January and possibly February. Start preparing by contacting sites you are interested in and building a solid application (documentation of hours, case book, etc.) in August or September if you can.  Most Match clinical neuropsych postdocs require you to have done an APA accredited internship, which we don’t have – ugh – but don’t despair because not all do.  You can still contact postdoc sites on a site by site basis to check if they truly do require an APA-accredited fellowship. Some will say they only take people with an APA-accredited internship but will actually still consider you if you have done non-APA placements, especially because you have had outstanding training in Australia.  There are also a number of sites which take clinical postdocs that do not go through the match. I contacted sites directly and applied to a series of places that take people from non-APA approved backgrounds.
  2. You can contact sites you would like to go to directly, i.e., outside the match, and ask to speak to the person who manages their doctoral training programs in neuropsychology. You can then organize to get the experience this way, though they will need to have a formal fellowship program (they should be able to tell you if you can get licensed through their program).

The two-year postdoctoral fellowship in neuropsychology is a paid position and you traditionally earned between $39-45k.  I believe the legal minimum is now $47,462 pending a legal increase in the last months of Barack Obama's tenure as President if you are not paid separately for overtime (you can read about this here). Luckily the cost of living in the US is a lot cheaper. If possible, you want to be at an APA-accredited site. This is simply because they are more highly regarded. This isn’t essential though so don’t worry if you can’t track one down, though ideally you would like an APPIC-accredited fellowship. The only limitation of doing a non APA-accredited program, so far as I can tell, is that you cannot work in the VA (Veterans’ Affairs) system.

3.  Examinations

a. The Examination for Professional Practice in Psychology

Finally, you will need to sit for an exam to prove that you know everything required to be a psychologist. This will not be a major obstacle for you, if your training was similar to that received by US psychologists (which you have already worked out, above).  The exam is called the EPPP, and after a state has evaluated your degree and accepted your first year of clinical experience from your doctorate or first year of your fellowship, they will authorize you to register here.

The EPPP is daunting, but it’s not so bad.  It’s basically a series of multiple choice questions on all areas of psychology. That’s right… you need to recap organizational, developmental, clinical, etc. etc. There are some great programs that allow you to relatively rapidly get up to speed on all the information you’ve gradually forgotten since you completed your undergraduate training (email me and I can pass on details). The EPPP will set you back around $650 USD in total. If you buy the training materials from a preparatory program, that will cost you a few hundred extra second hand on ebay.

I allocated about 10 weeks to prepare around full time work (i.e., nights and weekend) using second hand materials from PsychPrep which you can buy direct or on ebay, or perhaps amazon.  I took this amount of time because I had done my degree coursework about six-seven years prior.  Other students who had finished their course work in the last few years took various strategies, including preparing around full time work over the course of 1 month or 2 months, while another few people took either 1 or 2 weeks off work and studied full time then went in and passed the exam.  Everyone comes out feeling they genuinely do not know how they did – i.e. that they could fail – then everyone I knew who took it passed.  The uncertainty likely comes from the fact that 50 of the 225 multiple choice questions are new questions that they are trying out (they don’t count towards your total score), so you may be completely unfamiliar with them.

Regarding preparation material, PsychPrep is good, as is AATBS.  Having looked at both, PsychPrep seems to me (and other postdoctoral fellows I’ve spoken) to to give you all the key information without going into too much additional detail.  Psychprep has great audio presentations of the written material.  While this is redundant, it is actually great to listen to the material while reading it and making notes, especially if you’re tired and trying to study in the evenings around full time work.

b. State examination.

After you pass the EPPP, you may also need to sit a state licensing exam, but these are usually small and easy and cost relatively little to sit.  They vary in their complexity, however.  For example, Connecticut gives you a PDF of the regulations to learn and tests you with 25 multiple choice questions (pass = 18).  Conversely, my understanding is California just asks you to learn their regulations and then gives you a 125 multiple choice question exam (100 items scored).  Psychprep also provides materials for preparing for the CA exam (the CPSE).

Hang on, maybe I can just find one of the easiest states to get registered in (e.g., Maine), and then get my degree cross-recognized in the state I want to work in…

The ethics of this are obviously questionable, and this should not be a strategy for licensure.  Regardless, note that most states will not recognize your out-of-state license until you have worked in the state you are licensed in for 5 years, and some will still evaluate your academic credentials anyway.  Other states’ websites say they will recognize licenses from other states, but when you contact them to ask it turns out they actually don’t.

So what’s the next step for me?

If you are licensed in Australia, contact the board of the state you are wanting to license in and check reciprocity (will they recognize your Australian license?).  Find the board by googling “<state> license psychology”.  You may want to mention the type of your degree, the fact that it included a formal year+ internship (placements), the fact that it included content in each of that state’s content areas, the fact you have also taken a national licensing exam (if this is the case) and finally the number of years you’ve practice for.

If you are not licensed in Australia (or are and the state doesn’t recognize your degree), check if you meet their legal criteria for the doctorate and the clinical training.  You can get a rough idea by seeing if it fulfills those criteria from the ASPPB/National Register Designation Project as discussed above.  Then check if your clinical experience in Australia will count towards their definition of experience, again by checking their regulations.  Then draft as brief an email as possible to the licensing department, and check if the understanding you now have is correct and confirm your next steps.

If your clinical experience is accepted (unlikely, unfortunately), you could then apply for licensure and you will get approved to take the EPPP exam (above).  After passing this you’ll take any state exam and then you’ll be licensed.

If your clinical experience is not accepted, you would then look at finding a fellowship, as noted above.  Start your search by joining the APA list serv for neuropsychology, and just hitting the websites of institutions you would like to go to and contacting the relevant neuropsych departments. During your fellowship you would apply to the relevant state board for licensure (after you have their equivalent of a year’s supervised experience, e..g 1600 or 1800hrs).  You will then find out definitively any additional coursework the board would like you to take, and be authorized for the EPPP.  After passing this you’ll take any state exam and then you’ll be licensed.


The visas are relatively straightforward. In my (limited) experience the sponsoring institution are not too concerned about this, they’ve dealt with it many times before. They will likely sponsor you on a J1, H1B or an E3 visa. Ask them for the E3 if you feel comfortable doing this.  There are actually benefits for them of using an E3 – it requires less paperwork I believe.  For you, it is indefinitely renewable in 2 year increments, and if you have a spouse, they can also work in the US on your visa (not true of an H1B or J1).  It’s only available to Aussies). If the institution has nice staff they will be happy to consider your opinion re. the visa class. They may not know about the E3 visa, though, so you just need to let them know it’s very straightforward and just like an H1B visa but easier for them in terms of paperwork. Per a recent question, you have to be married for your partner to work on your E3 visa (information here). If you get a J1, note that if you have the “two year rule” note on the visa, when your J visa runs out you have to return to Australia for at least two years before you can work in the US again. I believe this very rarely gets applied for Australians, but it is worth noting and possibly talking to the institution you are going to, or the consul, about this. How a consulate decides if you need the two year rule is unclear to me. From speaking with other foreign-trained academics it seems that Australians are less likely to have this requirement added to their visa.


If you refer to your training and experience using the terms used in the US, it will really help you have a positive experience with state boards.

  • Registration” in Australia is called “Licensure” in the US.  Licensure is governed by a different licensing board in every state.  Licensure is required to practice as a psychologist in the US.
  • Psychologist“.  A psychologist in the US is anyone with a doctoral degree in psychology.  While you can’t practice as a psychologist without licensure in the US state you are in, in most states (though apparently not New York), you can call yourself a Psychologist.
  • Director of Clinical Training” (DCT) is the formal term given in America to your program coordinator.
  • Placements” in Australia, which I take as being the multiple, 3-6-12 month supervised practice you complete during your graduate training, are equivalent to the US’ Internships.   The internship is a single year-long supervised clinical experience (so long as you have over 1 year of experience).  If you are speaking to a US board about getting licensed, refer to your placements collectively as your internship.
  • “Externships” in the US are unpaid, clinically-oriented psych work experience that graduate students get in years 1-4 of their doctoral program, before they apply for their internship.  The only reason you want to know about this is because if you can talk about any non-placement clinical experience you have had as an externship the programs or boards you are speaking with will understand what you are talking about and be more likely to give you credit for it.
  • Board-certification” is a voluntary process not necessary for practice as a neuropsych, but which is essentially equivalent to the CCN.  You go through a written and oral exam, and submit work samples (reports), to show you know enough to specialize in neuropsychology.  This is optional.  Board certification is managed by the American Board of Professional Psychology (ABPP), for neuropsychologists you apply for certification to the board’s neuropsychology section, the ABCN.

Some states’ licensure board sites:
– California
– Massachusetts; specific criteria here.
– New York State