Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Monday, March 25, 2013

Bash Tips: Call aliases from shell your script

Use 'shopt -s expand_aliases' from your script to expand aliases:

$ cat aliases.sh 
#!/bin/bash

alias ll='ls -lFh'
type ll


$ ./aliases.sh
./aliases.sh: line 5: type: ll: not found


$ cat aliases.sh 
#!/bin/bash

shopt -s expand_aliases
alias ll='ls -lFh'
type ll


$ ./aliases.sh 
ll is aliased to `ls -lFh'

No comments: