Comments (8)
@dessalines I am not sure I understand your question. But you can use all the functions in .bashrc
, as long as you source it first in the same bass call:
bass source ~/.bashrc \; foo
Bass invokes bash behind the scene in non-interactive mode, so it does not source .bashrc
automatically, and you'll have to source it manually to use any function in it.
For example, my .bashrc
defines a function ll
that does ls -l
. bass ll
will fail, but bass source ~/.bashrc \; ll
will work just fine.
$ cat .bashrc
function ll {
ls -l
}
$ bass ll
bass: ll: command not found
$ bass source .bashrc \; ll
total 8
<snip>
from bass.
I do this with fish functions that look like
function lunch
bass source build/envsetup.sh \; lunch $argv
return $status
end
from bass.
@dessalines this is good to close? If not, please provide more details. Thanks!
from bass.
If bass isn't going to support bash -> fish functions, then its good to close, and add that as a disclaimer on the readme.
from bass.
Actually bash function should be easily usable as @tbodt pointed out. Another example:
$ cat x.sh
function foo {
echo 'foo'
}
$ bass source x.sh \; foo
foo
Basically, you source
before you invoke the function. Wrap the whole thing in a function/alias if you use it a lot:
$ alias foo 'bass source x.sh \; foo'
$ foo
foo
from bass.
I have a .bashrc
with many aliases, and functions in it. If I can run bass source .bashrc
, and it picks up all the aliases, why shouldn't it be able to handle many functions, if the parsing is that trivial?
from bass.
Bass imports aliases differently than you're describing above, it puts them all as fish aliases.
from bass.
@dessalines you are right. The approach above only works with bash functions. Aliases are imported differently. If an imported alias uses bash functions, then it will break.
My suggestion is to convert the few aliases you rely on into functions, and save them in a new file, say, aliases.sh
, and then do bass source foo.sh ; source aliases.sh ; bar
, where bar
is the converted alias.
from bass.
Related Issues (20)
- How does bass import function from bash and why nvm need sourced every time ? HOT 2
- Annoying virtualenv conflict HOT 1
- Newlines sourced as \\n string literals
- append_path: command not found
- Quotes disappear from arguments when running script through bass HOT 3
- No module named 'json' HOT 3
- bass -d "source someshell.sh" not exactly stay the same every time
- %WSLENV%: invalid variable name HOT 2
- Command 'python' not found HOT 5
- "Variables may not be used as commands" HOT 2
- variables cannot be bracketed HOT 1
- "Bass internal error!" when status code is not 0 HOT 5
- Sourcing bash alias with question mark triggers `No matches for wildcard` error HOT 3
- cannot read file system information bug HOT 1
- `$1` is set in contrast to bash HOT 8
- Test scripts: using double `dirname` does not work if command line is `./test_dollar_on_output.fish` HOT 1
- Alias with $* does not get correctly converted HOT 1
- Significantly slower to source paths to a different directory HOT 4
- Bass and ssh-agent aren't interacting well on Linux HOT 3
- Can bass convert script files? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bass.