I am new to bash. I am working on a project on a HPC sever, and having some trouble in changing a dynamic file into static.
I have created an alias "submitjob" Its tasks are:
- take a user input "job_ID"
- create a copy of generic slurm script - "submission_script_job_ID"
- submit this new slurm script (submission_script_job_ID) onto the cluster
alias submitjob='echo "What is the job_ID?"; read job_ID;cp /home/Shubham/generic_slurm_script.sh ./submission_script_$job_ID.sh; echo "Status: Submission script for $job_ID is created."; sbatch submission_script_${job_ID}.sh $job_ID; echo "Status: $job_ID submitted sucessfully."'
Snippet of the generic script:
#!/bin/bash
job_ID=$1
.
.
.
time /opt/apps/gaussian09/g09l/g09/g09 ./${job_ID}.com >./${job_ID}.log
This is working fine, but the problem is the new "submission_script_job_ID" is again dynamic, i.e. it needs the job_ID to run. Basically, it is just a copy of a generic file with a different file name. I want to change something in the code to make this new script static, i.e. instead of "job_ID.com" it should fill it with the input we provided earlier (job_ID). Is there a way to do that. I'm not sure if there is a way to edit this new script in the alias code itself. Any help/suggestion would be great. Thanks!!