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

Raspberry Pi OS • Re: problem with creating my own custom command

$
0
0
... it said "bash: print_my_input: command not found". can you tell me if this is broken or i did something wrong? thanks!!!!
There are two steps to building what you need.
  1. Create an executable .SH script (BASH, PYTHON) in a directory in your PATH such as /home/user/.local/bin
  2. Create link to the script file to a command name. Note, you may have a problem if the script name is the same as the command.

Code:

paul@p400PI:~ $ cd /home/paul/.local/binpaul@p400PI:~/.local/bin $ ls -hl test*-rwxr-xr-x 1 paul paul 48 Jun  2 10:25 test.shpaul@p400PI:~/.local/bin $ more test.sh#!/bin/bashsudo systemctl list-unit-files apt*paul@p400PI:~/.local/bin $ ln ./test.sh test_cmdpaul@p400PI:~/.local/bin $ ls -hl test*-rwxr-xr-x 2 paul paul 48 Jun  2 10:25 test_cmd-rwxr-xr-x 2 paul paul 48 Jun  2 10:25 test.shpaul@p400PI:~/.local/bin $ cd ~paul@p400PI:~ $ test_cmdUNIT FILE                 STATE   VENDOR PRESETapt-daily-upgrade.service static  -apt-daily.service         static  -apt-daily-upgrade.timer   enabled enabledapt-daily.timer           enabled enabled4 unit files listed.paul@p400PI:~ $

Statistics: Posted by DS256 — Sun Jun 02, 2024 2:31 pm



Viewing all articles
Browse latest Browse all 2487

Trending Articles