Skip to main content
edited body
Source Link
Alexander Mills
  • 10.9k
  • 28
  • 120
  • 214

This is a weird one - it should work.

I have this file /foo/home/foo/waldo.sh

#!/usr/bin/env bash waldo(){ if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1; } fi command waldo "$@" } export -f waldo; 

if I source the file with:

. "/foo/home/foo/waldo.sh"; 

and then run

waldo 

I get:

No command 'waldo' found, did you mean: Command 'aldo' from package 'aldo' (universe) waldo: command not found 

when I run "$(which waldo)"$(which waldo), it's empty, nothing there.

however, when I run type waldo, I get:

waldo is a function waldo () { if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1 }; fi; command waldo "$@" } 

anyone know why it's not being sourced or whatever?

This is a weird one - it should work.

I have this file /foo/home/waldo.sh

#!/usr/bin/env bash waldo(){ if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1; } fi command waldo "$@" } export -f waldo; 

if I source the file with:

. "/foo/home/waldo.sh"; 

and then run

waldo 

I get:

No command 'waldo' found, did you mean: Command 'aldo' from package 'aldo' (universe) waldo: command not found 

when I run "$(which waldo)", it's empty, nothing there.

however, when I run type waldo, I get:

waldo is a function waldo () { if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1 }; fi; command waldo "$@" } 

anyone know why it's not being sourced or whatever?

This is a weird one - it should work.

I have this file /home/foo/waldo.sh

#!/usr/bin/env bash waldo(){ if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1; } fi command waldo "$@" } export -f waldo; 

if I source the file with:

. "/home/foo/waldo.sh"; 

and then run

waldo 

I get:

No command 'waldo' found, did you mean: Command 'aldo' from package 'aldo' (universe) waldo: command not found 

when I run $(which waldo), it's empty, nothing there.

however, when I run type waldo, I get:

waldo is a function waldo () { if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1 }; fi; command waldo "$@" } 

anyone know why it's not being sourced or whatever?

Source Link
Alexander Mills
  • 10.9k
  • 28
  • 120
  • 214

sourcing bash script does not acquire function def

This is a weird one - it should work.

I have this file /foo/home/waldo.sh

#!/usr/bin/env bash waldo(){ if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1; } fi command waldo "$@" } export -f waldo; 

if I source the file with:

. "/foo/home/waldo.sh"; 

and then run

waldo 

I get:

No command 'waldo' found, did you mean: Command 'aldo' from package 'aldo' (universe) waldo: command not found 

when I run "$(which waldo)", it's empty, nothing there.

however, when I run type waldo, I get:

waldo is a function waldo () { if [[ -z $(command -v waldo) ]]; then npm install -g '@oresoftware/waldo' || { return 1 }; fi; command waldo "$@" } 

anyone know why it's not being sourced or whatever?