0

I'm just trying to change this path with a simple shell script. If I type in the commands one by one it works no problem. If I put it in a shell script and run it it runs fine with no errors but does not alter the path.

#!/bin/bash
export PATH=~/Library/Python/3.4/bin:$PATH
source ~/.bash_profile

What am I doing wrong here?

If I double click on the file the output is...

    /Users/Parthenon/Desktop/ShellScripts/changeawsebpath ; exit;
Philips-MBP:~ Parthenon$ /Users/Parthenon/Desktop/ShellScripts/changeawsebpath ; exit;
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
1
  • 2
    How are you running the script and where are you expecting PATH to be changed? A script cannot alter its parent's environment, you must source for that to happen Commented Oct 20, 2016 at 18:09

1 Answer 1

-2

The =~ is an conditional BRE operator vs an assignment

Sign up to request clarification or add additional context in comments.

3 Comments

That only applies inside conditionals. (As an aside, the =~ operator supports (platform-dialect) EREs.)
...and not just inside conditionals in general, but specifically inside [[ ]].
@CharlesDuffy: Good point; additionally, =~ would only be recognized as an operator if surrounded by whitespace.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.