Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 4008  / 3 Years ago, tue, may 11, 2021, 2:37:24

I'm trying to check some files existence using -f command followed by the file bath but I have an error. This is my script:



initUCounter="/home/teeba/users_counter_initial_value"
initPCounter="/home/teeba/number_of_processes"
if [! -f $initUCounter && ! -f $initPCounter]
then
echo "0" > /tmp/users_counter_initial_value
echo "1" > /tmp/processes_counter_initial_value
fi

More From » bash

 Answers
3

Apart from Rmano's answer you can use,



if [ ! -f $initUCounter ] && [ ! -f $initPCounter ]; then
some action
else
some other action
fi

[#26987] Thursday, May 13, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ithriv

Total Points: 46
Total Questions: 115
Total Answers: 96

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
ithriv questions
Tue, Mar 14, 23, 14:31, 1 Year ago
Wed, Oct 5, 22, 02:59, 2 Years ago
Fri, Mar 11, 22, 10:12, 2 Years ago
Thu, May 11, 23, 10:55, 1 Year ago
Sun, Sep 26, 21, 06:47, 3 Years ago
;