I am trying to build a task automation script using python and for that, I am following a tutorial from youtube.
.my_commands.sh
#!/bin/bash
function create() {
python create.py
echo $1
}
create.py
print('Hello World')
and then in command prompt, I run this command create aditya which is supposed to print this according to tutorial.
Hello World
aditya
but instead it gives some error like this.
'create' is not recognized as an internal or external command,
operable program or batch file.
In the tutorial they were using mac system and i want to know is this possible to do the same on windows? If not why ?
my_commands.shand somehow call thecreate()function within that Bash script.create. Did you source.my_commands.shbefore trying to use your function?chmod +x fileName?fileNameare you talking about? You have in your posting only one file (.my_commands.sh), and since this file defines a function you want to use, it must be sourced by the shell which is supposed to use this function, and since it is a file to be sourced, you don't need x-bit. You also wouldn't need the#!line, though it is a good idea to have in, so that text editors can recognize what kind of syntax highlighting has to be applied.