Created
April 7, 2009 10:01
-
-
Save ngty/91167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
`cat ~/.bash_aliases | egrep '^alias' | sed 's/alias//'`.split("\n").each do |line| | |
parts = line.strip.split(/=/) | |
name, cmd = parts[0], parts[1].gsub(/('|")/,'') | |
file = '/home/%s/.config/fish/functions/%s.fish' % [`whoami`.strip, name] | |
content = [ 'function %s' % name, ' %s $argv;' % cmd, 'end' ].join("\n") | |
File.open(file, 'w+'){|io| io.write(content) } | |
end |
why not juse copying .bash_aliases and then convert '&&' to '; and' ('||' to ; or)? It works for mosf of my bash_aliases?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was exactly what I was looking for, and it worked flawlessly (after modifying the relevant paths, of course.)
Thank you so much!