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

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
6번째 줄: 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
13번째 줄: 13번째 줄:
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 #2
# File not found #2
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]
<source lang='PHP'>
<syntaxhighlight lang='PHP'>
file_put_contents('/tmp/a.txt', 'unlinkJohn 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;
24번째 줄: 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>


==같이 보기==
==같이 보기==

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

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

1 Bash[ | ]

Bash
Copy
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[ | ]

PHP
Copy
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 같이 보기[ | ]