"Delete file"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 4개는 보이지 않습니다)
1번째 줄: 1번째 줄:
[[category: File]]
[[category: File]]
{{다른뜻|리눅스 unlink}}
;unlink
;unlink
;rm
;rm
5번째 줄: 6번째 줄:
==Bash==
==Bash==
[[category: Bash]]
[[category: Bash]]
<source lang='Bash'>
<syntaxhighlight lang='Bash'>
echo 'John Smith' > /tmp/a.txt
echo 'John Smith' > /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #1'; fi
if [ ! -f /tmp/a.txt ]; then echo 'File not found #1'; fi
11번째 줄: 12번째 줄:
rm -f /tmp/a.txt
rm -f /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #2'; fi
if [ ! -f /tmp/a.txt ]; then echo 'File not found #2'; fi
# File not found
# File not found #2
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]
<source lang='PHP'>
<syntaxhighlight lang='PHP'>
file_put_contents('/tmp/a.txt', 'John Smith');
file_put_contents('/tmp/a.txt', 'unlinkJohn Smith');
if( !file_exists('/tmp/a.txt') ) echo 'File not found #1'.PHP_EOL;
if( !file_exists('/tmp/a.txt') ) echo 'File not found #1'.PHP_EOL;


23번째 줄: 24번째 줄:
if( !file_exists('/tmp/a.txt') ) echo 'File not found #2'.PHP_EOL;
if( !file_exists('/tmp/a.txt') ) echo 'File not found #2'.PHP_EOL;
// File not found #2
// File not found #2
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==
*[[file_exists]]
*[[file_exists]]
*[[file_put_contents]]
*[[리눅스 unlink]]

2020년 11월 2일 (월) 02:34 기준 최신판

  다른 뜻에 대해서는 리눅스 unlink 문서를 참조하십시오.
unlink
rm

1 Bash[ | ]

echo 'John Smith' > /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #1'; fi

rm -f /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #2'; fi
# File not found #2

2 PHP[ | ]

file_put_contents('/tmp/a.txt', 'unlinkJohn Smith');
if( !file_exists('/tmp/a.txt') ) echo 'File not found #1'.PHP_EOL;

unlink('/tmp/a.txt');
if( !file_exists('/tmp/a.txt') ) echo 'File not found #2'.PHP_EOL;
// File not found #2

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}