I write a bash script in my .sh which takes class name as its argument.
When this script is run, it creates a directory named class in the same space as that of the the script.
Then, it creates a PHP file with the same class name received from the argument inside the class directory. But if there is a same file already, exit the program instead.
Problem: It is working on Microsoft's windows but I need to work it also on Gnu/Linux
This is my .sh
#!/bin/bash
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdir -p $CURRENT_PATH/class
cd $CURRENT_PATH/class
if [ -f "[email protected]" ];
then
exit 1
else
echo "class $@
{
}" > [email protected]
fi