Make shell prompt aware of commands in.bashrc
Originally posted by @haltriumph in https://github.com/yorukot/superfile/discussions/185#discussioncomment-14535079 Great app! Thanks very much.
- The superfile shell prompt does not seem to know about the command I defined in my .bashrc file. Is there a way to set them up in superfile?
If you execute ls we would do it via exec.Command(["ls"])
One way is to do it via exec.Command["bash", "-c", "ls"]) .
That way it could understand bash.
Just one idea.
Thanks for setting this up. I assume that your response concerns how you would implement this change in the code and not something that I can do now, right? BTW: I wasn't very clear about what I was asking, and so let me put it another way. I don't understand what I can do in the surperfile prompt mode. Which commands work, for example.
I have a few scripts that I use that don't require output. It would be useful if I could run them with the shell prompt. I currently have aliases set up in my .bashrc file, but is doesn't need to be through bash. Indeed, it might be as simple as putting the scripts in spf's path. What path does it use or how can I tell the code to run these scripts?
Thanks again...
I assume that your response concerns how you would implement this change in the code
Yes
it might be as simple as putting the scripts in spf's path. What path does it use or how can I tell the code to run these scripts?
If you ensure that the scripts are in a directory which is in your $PATH, then spf can execute it.
➜ bin cat hello.sh
echo hello
echo $(date) >> /Users/nitin/go/bin/hello.log
➜ bin pwd
/Users/nitin/go/bin
➜ bin tail -f hello.log
Mon Sep 29 18:35:56 IST 2025
Mon Sep 29 18:37:02 IST 2025
➜ bin echo $PATH
/Users/nitin/.nvm/versions/node/v24.6.0/bin:/Users/nitin/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/nitin/go/bin
➜ bin pwd
/Users/nitin/go/bin
➜ bin ls
golangci-lint gopls hello.log hello.sh staticcheck
➜ bin
That worked. I hadn't though of the idea of using a log file to trap the output. That make this more useful.
Thanks!
this might be hard to do for other shells
not everyone uses bash. as far as i know, many switched to zsh, fish or nu, and windows users use pwsh (or zsh if people use wsl/msys2)
so there needs to be a way to specify the command needed to run the function
on top of that, I'm not entirely sure if pwsh loads the $PROFILE config, which means the functions may not work at all
another approach, we could check the $SHELL variable value and use it in the prompt
and maybe fallback to the old way if we arent able to detect the user shell