enthuguy
asked on
how to search/update a property value in bash
How to update status value using function and passing JOB_NAME and STATUS value and get the response code
Function trying to come up with
========================== ========== ===
#!/bin/bash
function CallStatusUpdate(){
aJobName=$1
ajobCurrentStatus=$2
# Search for $1 (job_1) and update job_1_status=$2 (job_1_status="started")
}
returncode=$(CallStatusUpd ate "job_1" "started")
echo $returncode
========================== ========== ===
Input Task.txt
==============
job_1_name=job1
job_1_asset=task1
job_1_dependent_on="none"
job_1_status="not started"
job_1_description="descrip tion of task1"
job_1_arg1="some arg1"
job_1_arg2="some arg2
job_1_arg3="some arg3"
job_1_arg4=none
job_1_arg5=none
job_2_name=job2
job_2_asset=task2
job_2_dependent_on="job1"
job_2_status="not started"
job_2_description="descrip tion about this task"
job_2_arg1="some arg1"
job_2_arg2="some arg2
job_2_arg3="some arg3"
job_2_arg4=none
job_2_arg5=none
job_3_name=job3
job_3_asset=task3
job_3_dependent_on="job1,j ob2"
job_3_status="not started"
job_3_description="descrip tion about this task"
job_3_arg1="some arg1"
job_3_arg2="some arg2
job_3_arg3="some arg3"
job_3_arg4=none
job_3_arg5=none
Function trying to come up with
==========================
#!/bin/bash
function CallStatusUpdate(){
aJobName=$1
ajobCurrentStatus=$2
# Search for $1 (job_1) and update job_1_status=$2 (job_1_status="started")
}
returncode=$(CallStatusUpd
echo $returncode
==========================
Input Task.txt
==============
job_1_name=job1
job_1_asset=task1
job_1_dependent_on="none"
job_1_status="not started"
job_1_description="descrip
job_1_arg1="some arg1"
job_1_arg2="some arg2
job_1_arg3="some arg3"
job_1_arg4=none
job_1_arg5=none
job_2_name=job2
job_2_asset=task2
job_2_dependent_on="job1"
job_2_status="not started"
job_2_description="descrip
job_2_arg1="some arg1"
job_2_arg2="some arg2
job_2_arg3="some arg3"
job_2_arg4=none
job_2_arg5=none
job_3_name=job3
job_3_asset=task3
job_3_dependent_on="job1,j
job_3_status="not started"
job_3_description="descrip
job_3_arg1="some arg1"
job_3_arg2="some arg2
job_3_arg3="some arg3"
job_3_arg4=none
job_3_arg5=none
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER