Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # first argument is the name of the folder and the c file
- fileName=$1
- # change to the desired folder
- filePath='/Users/apple/Documents/coding/c/c_generated/'
- folderToCreate="$filePath$fileName"
- fileToCreate="$filePath$fileName/$fileName.c"
- helloWorld="#include<stdio.h>\n\nint main(){\n\tprintf(\"Hello world\");\n}\n"
- if [ ! -d "$folderToCreate" ]; then
- echo "creating file at : $folderToCreate"
- mkdir $folderToCreate && touch "$fileToCreate"
- echo -e $helloWorld >> $fileToCreate
- fi
- echo "opening file : $fileName"
- cd $folderToCreate
- vim $fileToCreate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement