Unix 쉘 스크립팅을 처음 사용합니다.주어진 경로에 파일이있는 경우 파일 표시
하나의 매개 변수를 파일의 주어진 경로에서 찾기 위해 파일 이름으로 사용하는 파일을 만들었습니다. 파일이 발견되면 파일을 표시하거나 적절한 메시지를 표시해야합니다.
파일 : FilePath.sh
#!/bin/sh
Given_Path=/user/document/workplace/day1
File_Name=$Given_Path/$1
# Here i got stuck to write the if condition,
# to check for the file is present in the given
# path or not.
if [---------] #Unable to write condition for this problem.
then
echo $1
else
echo "File not found"
fi
실행 : 실행 파일
$ bash FilePath.sh File1.txt
(아래 답변에 설명 된대로) '파일 테스트 연산자'라고합니다. – user1717259
@ user1717259, 예! 너 맞아. – MAK