Hey Guys,
Is there a way to make aliases available in a shell? I tried sourcing a file with aliases before invoking my alias with no luck… ie:
shell: . ~/.bash_aliases && my_command args
Any help would be appreciated.
Hey Guys,
Is there a way to make aliases available in a shell? I tried sourcing a file with aliases before invoking my alias with no luck… ie:
shell: . ~/.bash_aliases && my_command args
Any help would be appreciated.
Is there a way to make aliases available in a shell? I tried sourcing a file with aliases before invoking my alias with no luck
https://linux.die.net/man/1/bash :
Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt
Cheers,
Paul
Thanks Paul, that makes sense.
Is it possible to set this behavior within Ansible? I tried the following without any luck…
shell: rs -z blah_blah
args:
creates: “{{ current_flags }}/{{ item }}_{{ ansible_date_time.date }}”
executable: /bin/bash +O expand_aliases
Is it possible to set this behavior within Ansible? I tried the following without any luck…
I would recommend that you don’t use aliases in non-interactive shells. If the script grows, maybe use the script-module instead https://docs.ansible.com/ansible/script_module.html . Another option is to use shell functions instead of aliases.
Cheers,
Paul