
명령줄을 통해 간단하고 빠른 프로그램을 만들고 그 결과를 Firefox에 표시하고 싶습니다...
그리고 나는 Hello World가 그것을 배우는 가장 간단한 방법이라는 것을 알았습니다 :)
내가 어떻게 해?
답변1
원 라이너로?;)
echo '<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>Hello World</body></html>' > index.html && xdg-open index.html
awk
명령줄이기도 하므로
awk '//' <<<'<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>Hello World</body></html>' > ~/tmp/index.html && xdg-open ~/tmp/index.html
끔찍한, 그러나 또한 가능합니다
echo "Hello World" > index.html && xdg-open index.html
답변2
vi
콘솔에 입력하고 , i
HTML 코드를 누르고 입력하고, :w index.html
Enter를 눌러 확인하고, 입력 :silent !firefox %
하고 즐기세요!