|
What is the difference between executing a bash script like A and sourcing a bash script like B?
A >./myscript B >source myscript
Started by Scottie T on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Sourcing is essentially the same as typing each....
Executions are independent from the parents environment.
So if you have configs or function definitions you should source and not execute .
Sourcing you get all the extra variables defined in the script .
|
|
I have 1 bash script that runs another bash script, however the first bashscript isn't waiting for the second one to complete before proceeding, how can I force it to wait?
For example:
#!/bin/bash # first.sh #call to secondary script sh second.sh echo...
Started by BassKozz on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Try using bash.
Make sure ?) Check the exit code of second.sh after you run it ( sh second.sh ; echo $? ) .
Flag ( bash -x first.sh ) to see exactly what commands your script is executing.
|
|
What have you found to be useful in your .bash_profile ?
What tips do you have for people editing theirs ?
SEE ALSO: Useful BASH aliases ( ie: alias ... )
EDIT: I've removed my original .bash_profile added my current solution as an answer
Started by _ande_turner_ on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at superuser):
This helps prevent="-iMFXrj4a"
I'm now importing my .bashrc....
Very useful
alias q='cd ..; ls'
I don't have a ~/.bash_profile_COMMAND and a function so the color changes if you do sudo bash or su -m root .
\[^[[0m\] \$ \" fi \`"
And then this.
|
Ask your Facebook Friends
|
I'm running autoconf and configure sets SHELL to '/bin/sh'. This creates huge problems. How to force SHELL to be '/bin/bash' for autoconf?
I'm trying to get this running on osx, it's working on linux. Linux is using SHELL=/bin/bash. osx defaults to /bin...
Started by Flinkman on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Please don't hose your system by doing it!)
Where is SHELL being set to that? What is being run with /bin/sh when you want /bin/bash?
configure scripts are meant to run anywhere....
Ln -f /bin/bash /bin/sh
:-P (No, it's not a serious answer.
|
|
I have a Cygwin bash script that I need to watch and terminate under certain conditions - specifically, after a certain file has been created. I'm having difficulty figuring out how exactly to terminate the script with the same level of completeness that...
Started by Barry Kelly on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Here's my version:
#!/bin/bash function usage { echo "usage ;; esac shift done
The only real downside is....
This script looks like it'll do the job:
#!/bin/bash # Author: Sunil Alankar ## # recursive kill it, and with a couple more options.
|
|
But, to be honest the Obama bashing has been much nastier than the Bush bashing. Feel free to correct me if I am wrong. Okb
Started by OklahomaBill on
, 11 posts
by 3 people.
Answer Snippets (Read the full thread at network54):
Because there are no examples of you objecting to the Bush bashing....
But now you suddenly feel concerned? I will wait.
Even when your buddy from Australia routinely attacked the president of your own country .
You never said a word in protest about it.
|
|
Any way to do this?
I have a script that exports a few vars and runs a component.
I'm looking to find out the actual values of some of these vars while the process is running. (Which applies here, because I'll be incorporating those values into another...
Started by Monster on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you in your bash script export some environment variables, than.
But ...
|
|
What are some good bash tutorials? I would like to learn more about the bash shells commands and how to use them.
Started by Dynamic I on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at superuser):
Recommended online resources for learning bash scripting How to learn your way through Linux’s shell General search....
(Also available as a PDF file if you prefer that) .
Advanced Bash Scripting Guide from The Linux Documentation Project pages.
|
|
Hi
i have a .bash_favourites file which containes a list of my favourite commands.
I would like this be searchable via the normal bash history. ???
thanks
Ian
Started by stackian on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want to replace the regular history with your favorites: Do chmod u-w... .
Cat ~/.bash_favourites >> ~/.bash_history history -r
If you want to make this permanent, you can probably just add these lines to ~/.bash_profile.
|
|
How do I get the path of the directory in which a bash script is located FROM that bash script.
For instance, lets say I want to use a bash script as a launcher for another application. I want to change working directory to the one where the bash script...
Started by Jim Robert on
, 19 posts
by 19 people.
Answer Snippets (Read the full thread at stackoverflow):
`pwd`
(remember the backtics) will get you the current directory from within your bash script% sure I'm following you (it's late....
And not where you run the script from:
#!/bin/bash $orpath = 'set original path'; $path = `pwd`; if [ $path.
|