variable won't work when using script.sh file #200
-
I'm on Mac, I'm using default (bash). The working directory is empty. I put my script in my vault's root. I tried using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, thank you for your question! :)
What you can do to solve this, is to pass the values of these variables as arguments to your script file. This is how it's done in Bash: Your shell command: An example content of echo $1 # Prints the value of {{clipboard}}, because {{clipboard}} is the first argument.
echo $2 # Prints the value of {{file_path:relative}}, because {{file_path:relative}} is the second argument.
|
Beta Was this translation helpful? Give feedback.
Hi, thank you for your question! :)
{{variables}}
only work when they are used in the shell comand text, i.e. in your case the shell command text is/bin/bash script.sh
. The Shell commands plugin does not read thescript.sh
file at all, it's only read by Bash, and so Bash does not know{{clipboard}}
or{{file_path:relative}}
variables, which are specific to the Shell commands plugin.What you can do to solve this, is to pass the values of these variables as arguments to your script file. This is how it's done in Bash:
Your shell command:
/bin/bash script.sh {{clipboard}} {{file_path:relative}}
An example content of
script.sh
: