maxattax97

Bash Alias Sourcing Issue

Mar 28th, 2022
1,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.33 KB | None | 0 0
  1. lib.sh
  2. ```
  3. shopt -s expand_aliases
  4.  
  5. function my.func()
  6. {
  7.         echo "Hello, world!"
  8. }
  9.  
  10. alias mf='my.func'
  11. ```
  12.  
  13. run.sh
  14. ```
  15. #!/usr/bin/env bash
  16. shopt -s expand_aliases
  17.  
  18. source lib.sh
  19.  
  20. my.func
  21. bash --noprofile --norc -ci "source lib.sh; mf"
  22. ```
  23.  
  24.  
  25. output of run.sh
  26. ```
  27. Hello, world!
  28. bash: mf: command not found
  29. ```
Advertisement
Add Comment
Please, Sign In to add comment