I am running ./automate.sh file for taking results in results.csv file. ./automate first create results directory then will create results.csv file. but a error occur permission denied. Anyone can help me please how to sort out this issue?
this is automate.sh
#!/bin/bash
##### Set the paths to directories #####
base_path=/opt/ns-allinone-2.35/tcl_scripts/number_of_nodes ##### Main path where all source files exist #####
dim_mobility=$base_path/mobility/ ##### Path where mobility files are stored #####
dim_results=$base_path/results/ ##### Path where results are stores #####
##### Set the protocols and other parameters #####
header=0 ##### header flag of result.csv file. header is used to add header in result.csv file. #####
proto1=TRAODV ##### Protocol 1 for comparison #####
proto2=AODV ##### Protocol 2 for comparison #####
total_run=10 ##### Number of iterations for parameter #####
##### Remove the results directories if already exist #####
if [ ! -d $base_path ];
then
mkdir -p $base_path
fi
if [ -d $dim_results ];
then
rm -R $dim_results
fi
mkdir -p $dim_results
when i will run this .sh, no directory is created and no result.csv is created. here is error
VirtualBox:~/opt/ns-allinone-2.35/tcl_scripts/number_of_nodes$ ./automate.sh
rm: descend into write-protected directory ‘/opt/ns-allinone-2.35/tcl_scripts/number_of_nodes/results/’?
./automate.sh: line 59: /opt/ns-allinone-2.35/tcl_scripts/number_of_nodes/results//results.csv: Permission denied
question from:
https://stackoverflow.com/questions/65923986/how-to-give-mkdir-and-write-commands-in-ubuntu-14-04 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…