fish

How can I provide tab completions to fish shell from my own script?

拈花ヽ惹草 提交于 2019-12-03 01:40:50
I am running Ubuntu 13.10 and fish 2.1.0. I want to write myself a Python script to do some tasks from the command line. The script will require command line arguments. How can I write my script such that fish can request and get possible values for a given argument. The list of potential values is dynamic. That is, it will be determined programatically (e.g. a list of folder names matching some criteria). The end result I am aiming for is something like: user@machine ~> myprog argument=fol<TAB> folder1 folder2 folder3 Where myprog is my script file, argument is the argument name and folder1

Suppress or Customize Intro Message in Fish Shell

烂漫一生 提交于 2019-12-03 01:16:02
问题 Is it possible to remove the intro message in fish shell: Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish 回答1: Kevin's answer works fine for static text. If you need an interactive welcome message, such as mine involving the fortune command, you can do function fish_greeting Create your fish_greeting function. I just have function fish_greeting fortune end and save it with funcsave fish_greeting 回答2: Found that the greeting message is set in fishd

How do I unset a variable in the fish shell?

情到浓时终转凉″ 提交于 2019-12-02 19:55:56
In bash I can unset a variable with unset myvar In fish I get fish: Unknown command 'unset' What's the equivalent for unset in fish. J0hnG4lt Fish uses options on the set command to manipulate shell variables. Unset a variable with the -e or --erase option. set -e myvar Additionally you can define a function function unset set --erase $argv end funcsave unset or an abbreviation abbr --add unset 'set --erase' or an alias in ~/.config/fish/config.fish alias unset 'set --erase' 来源: https://stackoverflow.com/questions/30703860/how-do-i-unset-a-variable-in-the-fish-shell

On OS X, how do I change my shell from fish back to bash?

醉酒当歌 提交于 2019-12-02 17:32:10
I'm kinda preferring bash lately to fish, and I'm wondering if I can change it back. I tried this command: chsh -s /bin/bash but closing the terminal and reopening it does not restore it to bash, but it's still fish. In fact, how do I remove fish? Go to System Preferences, Users & Groups, click the lock to make changes, right click (or Control click) on your username, choose "Advanced Options" and you should have a field to change your shell. Change it there, reboot, and your new shell should take effect. Very easy: from FISH to BASH : In your Fish terminal, type bash --login to switch to Bash

how to set environment variables in fish shell

牧云@^-^@ 提交于 2019-12-02 17:22:33
Can someone please tell me what's the correct way to set a bunch of environment variables in the fish shell? In my .config/fish/config.fish file, I have a function to setup my environment variables like so function setTESTENV set -x BROKER_IP '10.14.16.216' set -x USERNAME 'foo' set -x USERPASS 'bar' end when I type from the command prompt setTESTENV and do a env in the command line, I don't see these information. The variables you are declaring are keep in a local scope inside your function. Use: set -g -x Here " g " is for global. Paolo Moretti Use Universal Variables If the variable has to

Cannot run source activate with conda in Fish-shell

99封情书 提交于 2019-12-02 17:08:43
I follow conda_PR_545 , conda issues 4221 and still not working on Ubuntu. After downloading conda.fish from here , and mv it to anaconda3/bin/. Add "source /home/phejimlin/anaconda3/bin/conda.fish" at the end of ~/.config/fish/config.fish. conda activate spark_env Traceback (most recent call last): File "/home/phejimlin/anaconda3/bin/conda", line 6, in sys.exit(conda.cli.main()) File "/home/phejimlin/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 161, in main raise CommandNotFoundError(argv1, message) TypeError: init() takes 2 positional arguments but 3 were given or activate

Suppress or Customize Intro Message in Fish Shell

筅森魡賤 提交于 2019-12-02 16:32:41
Is it possible to remove the intro message in fish shell: Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish workflow Kevin's answer works fine for static text. If you need an interactive welcome message, such as mine involving the fortune command, you can do function fish_greeting Create your fish_greeting function. I just have function fish_greeting fortune end and save it with funcsave fish_greeting Found that the greeting message is set in fishd.Machine.local. To override the following to ~/.config/fish/config.fish : set fish_greeting awelkie

How to generate letter sequence list in fish shell

匆匆过客 提交于 2019-12-02 00:06:54
In bash you can generate letter sequence easily as "{a..z}", for example $ echo {a..z} a b c d e f g h i j k l m n o p q r s t u v w x y z How to do that in the fish shell instead? Fish doesn't support ranges in brace expansion , only comma-separated values: {a,b,c} . Thus, we are forced to search for a command capable of generating such sequence. For example, you can use Perl: for c in (perl -e '$,="\n"; print ("a" .. "z")') printf ">> %s\n" "$c" end where $, is the output field separator. Output >> a >> b ...(skipped) >> y >> z You may find this table useful. One way is to use printf and seq

What's the equivalent to ${var:-defaultvalue} in fish?

瘦欲@ 提交于 2019-12-01 12:07:28
Hello I am trying to translate my .bashrc to fish format almost done, mostly is clear on the documentation but this part is giving me a headache.. is so my gnupg works with my yubikey ssh etc etc.. The fish version is latest 3.0 under Arch GNU/Linux original on BASH: # Set SSH to use gpg-agent unset SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" fi echo "UPDATESTARTUPTTY" | gpg-connect-agent > /dev/null 2&>1 Mine half converted into fish: set -e SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ] set -x SSH

Bash (or other shell): wrap all commands with function/script

喜欢而已 提交于 2019-12-01 03:47:11
Edit: This question was originally bash specific. I'd still rather have a bash solution, but if there's a good way to do this in another shell then that would be useful to know as well! Okay, top level description of the problem. I would like to be able to add a hook to bash such that, when a user enters, for example $cat foo | sort -n | less , this is intercepted and translated into wrapper 'cat foo | sort -n | less' . I've seen ways to run commands before and after each command (using DEBUG traps or PROMPT_COMMAND or similar), but nothing about how to intercept each command and allow it to