Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4890

General discussion • Re: problem with creating my own custom command

$
0
0
In order to define your new command, you first have to (somehow) execute the lines from that site that define the function. They show:

Code:

function print_my_input() { echo 'Your input: ' $1}
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"

Statistics: Posted by BigRedMailbox — Sat Jun 01, 2024 9:33 pm



Viewing all articles
Browse latest Browse all 4890

Trending Articles