I am a Linux user forced to work on a Windows workstation at work. I have a script that I wrote for bash, that I need to convert to Windows Batch. In the past, I haven't had too much trouble, but now I have run into two issues I cannot figure out. Here is the original Linux script:
#!/bin/bash
if [ $# != 1 ] ; then
echo "usage: createMavenDirs.sh <name>"
exit 1
fi
timestamp=`date +"%Y-%m-%d-%s"`
projectName="${1}_${timestamp}"
groupID="com.hostname"
version="1.0"
pomFill="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project>\n\t<modelVersion>4.0.0</modelVersion>\n\t<groupId>${groupID}.${1}</groupId>\n\t<artifactId>${1}</artifactId>\n\t<name>\${artifactId}</name>\n\t<version>${version}</version>\n</project>"
clear
mkdir -p ${projectName}/src/{main/{java,resources,filters,assembly,config,webapp},test/{java,resources,filters},site}
touch ${projectName}/{LICENSE,NOTICE,README}.txt
touch ${projectName}/pom.xml
echo -e ${pomFill} > ${projectName}/pom.xml
tree ${projectName}
exit 0
First off, I want to say that "yes", I know there are tools for doing this, but due to VERY tight constraints at work, I have to use an option like this. Second, here are the two problems I am having.
The "mkdir" line: Does Windows have a way to do this like Linux does?
The "echo" line where I create the pom file: Can Windows echo a newline and tab, and redirect it into an external file like I am doing in my Bash script?
Like I said, I know there are other ways to do this, but the powers that be have forced me down this path. Anyway, thank you to all who have taken the time to read.
Have a good day :-)
UPDATE: I realize that Windows does have an "echo" and "mkdir", but I need to be able to use them in a very specific way, just like I have used them in my Linux script. Specifically, I would like to make directories exactly like I have in my Linux script, and I need to echo a newline '\n' or '\r' and a tab '\t' into an external file.
UPDATE 2: I cannot install any new software/utilities/etc. onto my workstation. I must use only what is there.