I want to create a function in bash that executes another script with the same arguments passed to the first function.
This is what I've tried so far (I'm getting syntax errors):
.bashrc
my-fn {
/home/user/myScript "$@"
}
custom-script
#!/bin/bash
another-defined-fn "$@"
I'm getting the following errors when I try to source my .bashrc
-bash: /home/userx/.bashrc: line 206: syntax error near unexpected token `}'
-bash: /home/userx/.bashrc: line 206: `}'
What is the proper syntax to achieve this?
Extra
How can I include a sudo call inside the function?
Something like:
my-fn {
sudo /home/user/myScript "$@"
}