User Tools

Site Tools


средства_программирования_shell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
средства_программирования_shell [2022/06/06 10:18]
val [CGI на shell]
средства_программирования_shell [2022/06/29 13:22]
val [Web сервер на shell]
Line 4: Line 4:
   * [[http://​mywiki.wooledge.org/​BashFAQ|Часто задаваемые вопросы про bash (eng)]]   * [[http://​mywiki.wooledge.org/​BashFAQ|Часто задаваемые вопросы про bash (eng)]]
   * [[https://​habrahabr.ru/​post/​335960/​|Играючи BASH'​им]]   * [[https://​habrahabr.ru/​post/​335960/​|Играючи BASH'​им]]
 +
   * [[https://​youtu.be/​GxVmukxVUo0|Видео урок]]   * [[https://​youtu.be/​GxVmukxVUo0|Видео урок]]
 +
   * [[https://​www.tutorialspoint.com/​execute_bash_online.php|Execute Bash Shell Online]]   * [[https://​www.tutorialspoint.com/​execute_bash_online.php|Execute Bash Shell Online]]
 +  * [[https://​www.shellcheck.net/​|ShellCheck finds bugs in your shell scripts.]]
  
 ===== Проверка синтаксиса ===== ===== Проверка синтаксиса =====
Line 380: Line 383:
 #!/bin/bash #!/bin/bash
 base=/​var/​www base=/​var/​www
 +log=/​var/​log/​webd.log
  
 read request read request
Line 398: Line 402:
 if [ -e "​$filename"​ ] if [ -e "​$filename"​ ]
 then then
 +  echo `date` OK $filename >> $log
   echo -e "​HTTP/​1.1 200 OK\r"   echo -e "​HTTP/​1.1 200 OK\r"
   echo -e "​Content-Type:​ `/​usr/​bin/​file -bi \"​$filename\"​`\r"​   echo -e "​Content-Type:​ `/​usr/​bin/​file -bi \"​$filename\"​`\r"​
Line 403: Line 408:
   /bin/cat "​$filename"​   /bin/cat "​$filename"​
 else else
 +  echo `date` ERR $filename >> $log
   echo -e "​HTTP/​1.1 404 Not Found\r"​   echo -e "​HTTP/​1.1 404 Not Found\r"​
   echo -e "​Content-Type:​ text/​html;​\r"​   echo -e "​Content-Type:​ text/​html;​\r"​
Line 408: Line 414:
   echo -e "<​h1>​Not Found</​h1>"​   echo -e "<​h1>​Not Found</​h1>"​
 fi fi
- 
 </​code>​ </​code>​
  
средства_программирования_shell.txt · Last modified: 2024/05/10 17:17 by val