I'm trying to create a simple script that will dump all my aliases into a file that bash can load when it starts up, while making sure the alias of - to popd works properly:
alias -p | sed 's/alias -=/alias -- -=/' > ~/.bash_aliases
If I run that on the command line, it seems to work, but if I put it in a script and run that (with
#!/bin/bash at the top and
chmod +x), instead I get an empty file. Can someone tell me what bit of bash lore I'm missing?
If it matters, I'm using bash v4.2.10.