Running a command behind BASH prompt in bashrc [duplicate] - bash

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Start background process from .bashrc
I'm executing a script in .bashrc and the user prompt will not appear until all commands have executed. Is there a way, on launching a terminal, that the prompt appears while the commands execute in the background?
Thanks for any assistance!

append & to your command to have it run in the background.

Related

Running MATLAB script from terminal Mac [duplicate]

This question already has answers here:
matlab execute script from linux command line
(3 answers)
How to call MATLAB script from command line?
(4 answers)
Closed 1 year ago.
I am trying to run a matlab script from the terminal on MacOS. I am doing the following:
/../matlab -nodisplay -r
to open matlab from terminal, then to run the script that is on a different path I write
cd ('/.../test/')
test1.m
It runs, I get some error regarding the font. But I am not able to visualise the plots in the script, any suggestions?

Is there a way to automatically run an initialization script when starting Windows 10 Powershell? [duplicate]

This question already has answers here:
How do I configure a startup/config script for Powershell?
(2 answers)
Closed 2 years ago.
I have a couple of Windows 10 Powershell commands that I always enter at the start of a terminal session (to do key bindings to enable using up arrow to auto-complete a command from my command history). I made a shell script to do this, but is there a way to make it run automatically when I start the Powershell?
More details that may be relevant:
I am actually using the Anaconda Powershell (which I understand to be just a Windows Powershell).
The two commands are: Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
I currently have them in a script called init.ps1 that I can run when I start the Powershell (obviously, by typing init.ps1 ).
##############################
EDIT: Thank you for the response. Someone pointed out that there was a similar question posted:
How do I configure a startup/config script for Powershell?
Between these answers, I was able to set up a configuration script by creating a directory, C:\Users\(user)\Documents\WindowsPowerShell and placing a script called Microsoft.PowerShell_profile.ps1.
I think you would like to create a profile, and Microsoft's documentation has information on which type of profile, and other information at the following webpage,
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.1&viewFallbackFrom=powershell-7.

How to access WSL PATH from Powershell core? [duplicate]

This question already has an answer here:
What is the difference between calling a command via "wsl [command]" and opening a wsl shell and calling "[command]"?
(1 answer)
Closed 1 year ago.
If I open up the Ubuntu app (terminal) and type echo $PATH, I get a bunch of directories. If I type wsl echo $PATH in Powershell core, I get absolutely nothing (a blank row). I would like to run a Linux command from Powershell core, how do I do that?
That's because the .bashrc isn't run when you just run wsl <command>, you need to run wsl bash -c '<command>', or run <command> while inside a bash shell.

Can someone explain the difference between .bashrc and .bash_profile? [duplicate]

This question already has answers here:
What's the difference between .bashrc, .bash_profile, and .environment?
(7 answers)
Closed 3 years ago.
Can someone explain the difference between .bashrc and .bash_profile?
Examples would be great.
Thank you.
/.bashrc and ~/.bash_profile are scripts that might be executed when bash is invoked. The ~/.bashrc file gets executed when you run bash using an interactive shell that is not a login shell.
So basically bashrc is run when you run an interactive shell that you're not logged in for and bash_profile is executed when you are a logged in user.
Have a further read here: https://www.quora.com/What-is-bash_profile-and-what-is-its-use

vim - run :!commands in my .bashrc [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Commands executed from vim are not recognizing bash command aliases
Why doesn't my vim know my alias?
say I set
alias kapow='grep'
in my .bashrc, which I source after.
I open vim, type
:!kapow "dude"
but vim tries to run /bin/bash kapow, when I actually wanted it to run my alias.
How does one run commands from a bashrc inside of vim (without leaving to the :shell)?
The vim manual says this about :!
On Unix the command normally runs in a non-interactive shell. If you want an interactive shell to be used (to use aliases) set 'shellcmdflag' to "-ic".

Resources