In order to define your new command, you first have to (somehow) execute the lines from that site that define the function. They show:
In bash - you don't need the "function" keyword. I think that may be a ksh-ism or something.
So, what you should do is use your editor to put the following into a file, say "mycommand":
print_my_input() {
echo 'Your input: ' $1
}
Then do (at the bash $ prompt):
. mycommand
(note the dot at the beginning of that command).
Then you can do: print_my_input "This is a test"
Code:
function print_my_input() { echo 'Your input: ' $1}
So, what you should do is use your editor to put the following into a file, say "mycommand":
print_my_input() {
echo 'Your input: ' $1
}
Then do (at the bash $ prompt):
. mycommand
(note the dot at the beginning of that command).
Then you can do: print_my_input "This is a test"
Statistics: Posted by BigRedMailbox — Sat Jun 01, 2024 9:33 pm