echo 'deb http://mirror.yandex.ru/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://mirror.yandex.ru/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://mirror.yandex.ru/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://mirror.yandex.ru/debian/ bookworm-updates main contrib non-free non-free-firmware' > /etc/apt/sources.list
#!/bin/bash
[ -x /usr/bin/rpmbuild ] || { echo 'rpmbuild not found'; exit 1; }
mkdir -p /tmp/rb
cd /tmp/rb
echo 'Name: testpackage
Version: 999
Release: 111
Summary: test summary
License: qwe
%description
test package
%install
cp $HOME/your_file %buildroot
%files
/your_file' > temp.spec
rpmbuild -v --target noarch --define "_topdir $PWD" -ba temp.spec
if checkLocationExists "$path"; then
echo ok
fi
#или
checkLocationExists "$path" && echo ok
#!/bin/bash
echo 'server {
location /test/v2.0.3 {
modsecurity on;
proxy_pass http://10.1.0.6:3000;
}
location /test/v2.0.0 {
modsecurity on;
proxy_pass http://10.1.0.6:3000;
}
}' | sed -r '\!^\s+location /test/v2.0.0 \{!,/^\s+\}$/ s/:3000;/:5555;/'
#!/bin/bash
line=`grep -n '^ *location' myfile | sed -rn '1s/(.+):.+/\1/p'` # номер первой строки с location
sed -ri "$line s/.+/0000\n&/" myfile
каждая вставляемая строка должна оканчиваться слэшом
#!/bin/bash
location='
location /projects/test/v2.0.1-4 {
proxy_pass http://0.0.0.0:2222;
}'
sed -i "
/modsecurity/i ${location//$'\n'/\\$'\n'}
" MYFILE
truncate -s1g /tmp/disk
mkfs.ext4 -Fm0 -N10000 /tmp/disk
#!/bin/bash
perl -pe 's/
(
[^-]+- # часть1-
[^-]+- # часть2-
[^-]+ # часть3 без минуса
)
-.* # 3-й минус и всё остальное отбрасываем
/\1/x' <<< product-promo-video-photo-image
echo $((`</sys/class/backlight/intel_backlight/max_brightness`*55/100)) > /sys/class/backlight/intel_backlight/brightness