Home > OS >  Write a sh script judgment, to determine whether a given directory, exist the specified file (ok)
Write a sh script judgment, to determine whether a given directory, exist the specified file (ok)

Time:10-04

Write a sh script judgment, judgment under the specified directory, whether there is a specified file (ok), existence SQLLDR command, when there is no command over, until check to file SQLLDR command, this how to write

CodePudding user response:

For ((I=1; i<=100; I++))
Do
Echo $I
If [-f okfile]; Then
SQLLDR
The exit 1
Fi
done

CodePudding user response:

Can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

CodePudding user response:

refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong

CodePudding user response:

I wrote this
If [-f "$fileok"]; Then
SQLLDR...
Fi



So write words, it does not exist when the program is run out, at the back of the program will continue to run

CodePudding user response:

reference qq_45363110 reply: 3/f
Quote: refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong



#!/bin/bash

While 1 & gt; 0
Do
If [-f "$fileok"]
Then
SQLLDR
The exit
The else
Sleep 100
The continue
Fi
The done


You set a sleep time, had better not too short, because there is no ok files, will always cycle, time is too short, be afraid influence server

CodePudding user response:

reference 5 floor zhouchao6 reply:
Quote: refer to the third floor qq_45363110 response:

Quote: refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong



#!/bin/bash

While 1 & gt; 0
Do
If [-f "$fileok"]
Then
SQLLDR
The exit
The else
Sleep 100
The continue
Fi
The done


You set a sleep time, had better not too short, because there is no ok files, will always cycle, time is too short, be afraid influence server

This is an error to the grammar the else place of wrong, this is 100 seconds?

CodePudding user response:

refer to 6th floor qq_45363110 response:
Quote: refer to the 5 floor zhouchao6 response:
Quote: reference qq_45363110 reply: 3/f

Quote: refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong



#!/bin/bash

While 1 & gt; 0
Do
If [-f "$fileok"]
Then
SQLLDR
The exit
The else
Sleep 100
The continue
Fi
The done


You set a sleep time, had better not too short, because there is no ok files, will always cycle, time is too short, be afraid influence server

This is an error to the grammar the else place of wrong, this is 100 seconds?


Well, this is 100 seconds
My side format is a little problem, you again under the indentation

CodePudding user response:

refer to 7th floor zhouchao6 response:
Quote: refer to the sixth floor qq_45363110 response:

Quote: refer to the 5 floor zhouchao6 response:
Quote: refer to the third floor qq_45363110 response:

Quote: refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong



#!/bin/bash

While 1 & gt; 0
Do
If [-f "$fileok"]
Then
SQLLDR
The exit
The else
Sleep 100
The continue
Fi
The done


You set a sleep time, had better not too short, because there is no ok files, will always cycle, time is too short, be afraid influence server

This is an error to the grammar the else place of wrong, this is 100 seconds?


Well, this is 100 seconds
My side format is a little problem, you again under the indentation

It is ok to well below the indentation moves, the 100 seconds and then go back to the judge? Until he swept to the end?

CodePudding user response:

refer to the eighth floor qq_45363110 response:
Quote: refer to 7th floor zhouchao6 response:
Quote: refer to the sixth floor qq_45363110 response:

Quote: refer to the 5 floor zhouchao6 response:
Quote: refer to the third floor qq_45363110 response:

Quote: refer to the second floor zhouchao6 response:
can be used while/until cycle, but you're going to check all the time? Ok files, execution stops the script?

Yeah! Scenario is, I need to other systems of dat file loaded into our database, if you don't have judgment ok file is loaded will run empty, then all wrong



#!/bin/bash

While 1 & gt; 0
Do
If [-f "$fileok"]
Then
SQLLDR
The exit
The else
Sleep 100
The continue
Fi
The done


You set a sleep time, had better not too short, because there is no ok files, will always cycle, time is too short, be afraid influence server

This is an error to the grammar the else place of wrong, this is 100 seconds?


Well, this is 100 seconds
My side format is a little problem, you again under the indentation

It is ok to well below the indentation moves, the 100 seconds and then go back to the judge? nullnullnullnullnullnull
  • Related