我需要在apache配置中注释掉3行:
RewriteEngine On
#RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
#RewriteCond %{REQUEST_FILENAME} !-f <-
#RewriteCond %{REQUEST_FILENAME} !-d <-
#RewriteRule . index.php [L] <-
适用于1000台机器。
如何在所有这些机器上通过ssh在bsh命令上使用bash命令注释掉最后三行?
RewriteEngine On
#RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f <-
RewriteCond %{REQUEST_FILENAME} !-d <-
RewriteRule . index.php [L] <-
RewriteEngine On
#RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
#RewriteCond %{REQUEST_FILENAME} !-f <-
#RewriteCond %{REQUEST_FILENAME} !-d <-
#RewriteRule . index.php [L] <-
答案 0 :(得分:0)
您可以使用以下sed注释掉这些行:
resolv.conf
答案 1 :(得分:0)
如果要注释每个文件的后三行,则应该使用ed
:
ed file <<END
$;#
-2;#
s/[^[:blank:]]/#&/
+s
+s
wq
END
演示:
#!/bin/sh
f=$(mktemp)
trap 'rm "$f"' EXIT
cat >"$f" <<END
RewriteEngine On
#RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f <-
RewriteCond %{REQUEST_FILENAME} !-d <-
RewriteRule . index.php [L] <-
END
ed "$f" <<END >/dev/null
$;#
-2;#
s/[^[:blank:]]/#&/
+s
+s
wq
END
cat "$f"
输出:
RewriteEngine On
#RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
#RewriteCond %{REQUEST_FILENAME} !-f <-
#RewriteCond %{REQUEST_FILENAME} !-d <-
#RewriteRule . index.php [L] <-