6 ms·
Very cool. I really love fish but sometimes find it very annoying to translate random posix snippets from the web.
by yewenjie 5y ago
Very cool. I really love fish but sometimes find it very annoying to translate random posix snippets from the web.
- AYBABTME 5y agoThe trick is to enter bash from fish, run your command, and then call fish again. (fish)$ bash (fish>bash)$ source ./random.sh (fish>bash)$ fish (fish>bash>fish)$
- jpambrun 5y agoI think you should hit ctrl+d when you are done in bash to avoid the nested fish>bash>fish.
- AYBABTME 5y agoThe idea is to return to a fish shell, but with all the env-vars that bash might have loaded as a result of executing the script.
- knjmooney 5y ago`exec <shell>` would avoid nested shells and inherit the environment. Which might be preferable if you find your terminal emulator complaining about processes still running on close.
- R0flcopt3r 5y agoOr just simply: (fish)$ bash -c ./random.sh
- gnubison 5y agoNo need to use -c there: (fish)$ bash random.sh
- AYBABTME 5y agoThat doesn't give you the env vars that the script might have set.
- pxc 5y agoYou can use fenv or bass for that. They run a snippet or script of bash in bash, then import all the environment changes for you https://github.com/oh-my-fish/plugin-foreign-env https://github.com/oh-my-fish/plugin-foreign-env https://github.com/edc/bass https://github.com/edc/bass
- stjohnswarts 5y agocould you explain this? How could the script set env vars before you run it??
- sjmulder 5y agoWould it be better to ‘exec’ the shells to avoid the nesting?
- rgoulter 5y agoHave you made use of tools like babelfish? https://github.com/bouk/babelfish https://github.com/bouk/babelfish
- socialdemocrat 5y agoUnless it is really simple stuff why not just drop temporarily into bash? I mainly use fish for interactive work not for programming. Then I use a real programming language.
- markstos 5y agoWith Fish 3.0 and 3.1 it’s even more compatible with snippets you are likely to find to copy and paste. Do you remember something you found that doesn’t work?