Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

bash - how to give mkdir and write commands in ubuntu 14.04?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...