readlink $(which nest)
../../../Users//.config/yarn/global/node_modules/.bin/nest
file ../../../Users/userName/.config/yarn/global/node_modules/.bin/nest
../../../Users/userName/.config/yarn/global/node_modules/.bin/nest: cannot open `../../../Users/userName/.config/yarn/global/node_modules/.bin/nest' (No such file or directory)
/usr/local/bin/nest
ln -fs "правильный путь" /usr/local/bin/nest
tail -f /logs/catalina.out
sleep infinity
jq --arg k1 "first" --arg v1 "32" --arg k2 "second" --arg v2 "32" --arg k3 "third" --arg v3 "33" '. | .[$k1]=$v1 | .[$k2]=$v2 | .[$k3]=$v3' <<<'{}' ;
{
"first": "32",
"second": "32",
"third": "33"
}
#!/bin/bash
FILE="/tmp/file2.txt"
B='var arrIm = ['
L=$(cat $FILE | sed -e "s/\\(..*\\)/'\\1'/g" | sed -e 's|C:\\Users\\SEN\\Desktop\\777\\|https://ohiyo.ru/uploads/posts/|g')
E="
];"
echo "$B$L$E"
cat $FILE
C:\Users\SEN\Desktop\777\XXX.TXT
./a.sh
var arrIm = ['https://ohiyo.ru/uploads/posts/XXX.TXT'
];
#!/bin/bash
# или !/bin/sh в докере на apline
MSG='port 123'
if [[ "${MSG//[^a-z ]/}" == 'port ' ]]; then
echo "PORT = ${MSG//[^0-9]/}";
fi
MSG='host mysql_db'
if [[ "${MSG// [a-z_]*/}" == 'host' ]]; then
echo "HOST = ${MSG//host /}";
fi
PORT = 123
HOST = mysql_db
DATAFILE1="/tmp/data1.$$"
# NOTE: do not use | as a separator
cat<<EOF>$DATAFILE1
first:11:second:12:third:13
first:22:second:22:third:23
first:32:second:32:third:33
EOF
1>&2 echo 'Loading:'
1>&2 cat $DATAFILE1
1>&2 echo '---'
DATAFILE2="/tmp/data2.$$"
DATAFILE2="/tmp/data.tmp.json"
IFS=':'; cat $DATAFILE1| while read KEY1 VALUE1 KEY2 VALUE2 KEY3 VALUE3; do
jq --arg k1 "$KEY1" \
--arg v1 "$VALUE1" \
--arg k2 "$KEY2" \
--arg v2 "$VALUE2" \
--arg k3 "$KEY3" \
--arg v3 "$VALUE3" \
'. | .[$k1]=$v1 | .[$k2]=$v2 | .[$k3]=$v3' \
<<<'{}' ;
done > $DATAFILE2
DATA_KEY='data'
# making the rowset keyed by $DATA_KEY
# TODO: explore alternatives
cat $DATAFILE2 | jq --slurp '.' | jq "{\"$DATA_KEY\": .}"
Loading:
first:11:second:12:third:13
first:22:second:22:third:23
first:32:second:32:third:33
---
{
"data": [
{
"first": "11",
"second": "12",
"third": "13"
},
{
"first": "22",
"second": "22",
"third": "23"
},
{
"first": "32",
"second": "32",
"third": "33"
}
]
}
(echo step 1 && sleep 5 && echo step 2 ) | tee /tmp/a.log
res=$(cat /tmp/a.log)
echo $res
step 1 step 2
/tmp/a.txt
a A
b B
c C
while read s d; do echo "$s" "$d" ; done </tmp/a.txt
a A
b B
c C
/tmp/a.txt
a
b
c
while read s ; do
d=$(echo $s|sed's|^.*/||')
echo "$s" "$d" ;
done </tmp/a.txt
1
а не l
) но помоему удобнее tr
так что самые новые в конце а не вначале (ну и tail
вместо head
cp -P /tmp/a /tmp/b.xml^M
/tmp/b.xml^M
\r
sed -i 's|\r||g' a.sh