Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
[给喜欢写脚本自娱自乐热] --- 文字转二维码
deepin Talks
584
views ·
2
replies ·
To
floor
Go
i8520
deepin
2020-05-22 20:54
Author
本帖最后由 i8520 于 2020-5-22 13:12 编辑
[给喜欢写脚本自娱自乐热] --- 文字转二维码
QarencodeQRcode.zip
目录结构 123文件夹只能在/hone/$USER下 不能在 / 根目录 最直观的就是桌面了
install.sh 是相对绝对路径 123谁便什么名字 `pwd` 是相对 install.sh 的当前路径 补全路径
Copy the Code
123 --- install.sh
| --- data
| --- Xqrencode
| --- desktop
| --- gui-Xqrencode.desktop
Copy the Code
install.sh 755权限
#!/bin/bash
echo "第一条sudo需要输入密码。"
sudo -S `date +%Y年%m月%d日%H:%M:%S`
#更新系统软件源
echo "开始更新系统。"
sudo apt update -y && sudo apt upgrade -y
echo "系统更新结束,开始安装依赖,qrencode是真正起到作用的程序。"
sudo apt-get install qrencode -y
echo "qrencode安装结束,开始复制,运行脚本和启动文件。"
##################################################################
# -d文件夹 -f文件 -s是否空文件
if [ ! -d "~/.config/autostart" ]
then
mkdir -p ${HOME}/.config/autostart
fi
##################################################################
rm -rf ~/桌面/gui-Xqrencode.desktop
cp -r `pwd`/desktop/gui-Xqrencode.desktop ~/桌面
chmod -R 755 ~/桌面/gui-Xqrencode.desktop
##################################################################
chmod -R 755 `pwd`/data/Xqrencode
#------------------------------------------------------------------
sudo rm -rf /bin/Xqrencode
#------------------------------------------------------------------
sudo cp -r `pwd`/data/Xqrencode /bin
##################################################################
echo "安装结束,启动文件在桌面,启动脚本Xqrencode在 /bin"
exit 0
Copy the Code
gui-Xqrencode.desktop 755权限
[Desktop Entry]
Name=gui-Xqrencode
Name[zh_CN]=文字转二维码
Terminal=false
Type=Application
Categories=Graphics;
StartupNotify=false
Actions=Configure;Capture;
Exec=Xqrencode
Icon=utilities-terminal
Copy the Code
Xqrencode 755权限
#!/bin/bash
#2020.05.19.17.24 修改
#卸载qrencode
#sudo apt-get autoremove --purge qrencode -y
#删除多余的包或依赖
#sudo apt autoremove -y
#----------------------------------------------------------------------------
mkdir -p /tmp/text123
text_tixing="[使用注意事项-特殊符号不能输入,在接下来的输入框中输入,文字或网址 ]"
zenity --info --width=500 --text="$text_tixing" || exit
#----------------------------------------------------------------------------
rm -rf /tmp/text123/123.txt
echo "" >> /tmp/text123/123.txt
text_entry_1="[1]该行留空表示 不创建"
text_entry_2="[2]该行留空表示 不创建"
text_entry_3="[3]该行留空表示 不创建"
text_text_1=""
text_text_2=""
text_text_3=""
text_1=$(zenity --entry --width=500 --title="$text_entry_1" --text="$text_text_1") || exit
text_2=$(zenity --entry --width=500 --title="$text_entry_2" --text="$text_text_2") || exit
text_3=$(zenity --entry --width=500 --title="$text_entry_3" --text="$text_text_3") || exit
cat > /tmp/text123/123.txt<
<1>${text_1}<>
<2>${text_2}<>
<3>${text_3}<>
EOT
#------------------------------------------------------
tmp123="/tmp/text123/123.txt"
pxx1=`sed -n '1p' $tmp123 | cut -d '>' -f2 | cut -d '<' -f1`
pxx2=`sed -n '2p' $tmp123 | cut -d '>' -f2 | cut -d '<' -f1`
pxx3=`sed -n '3p' $tmp123 | cut -d '>' -f2 | cut -d '<' -f1`
#------------------------------------------------------
#这个模块本来是传递文件夹的,能用就行了 转换了一下变量 a = $pxx1 我想不那样也可以 只是要在个结构里
#本来几毫秒就可以创建的事情 加到了6秒以上
for a in "$pxx1" ; do
qrencode -o ~/桌面/test-`date +%M:%S`.png -s 18 ${a} ; sleep 2
done | zenity --progress --pulsate --title "Processing " \
--text "正在生成维码" \
--pulsate --auto-close --auto-kill
#------------------------------------------------------
for b in "$pxx2" ; do
qrencode -o ~/桌面/test-`date +%M:%S`.png -s 18 ${b} ; sleep 2
done | zenity --progress --pulsate --title "Processing " \
--text "正在生成维码" \
--pulsate --auto-close --auto-kill
#------------------------------------------------------
for c in "$pxx3" ; do
qrencode -o ~/桌面/test-`date +%M:%S`.png -s 18 ${c} ; sleep 2
done | zenity --progress --pulsate --title "Processing " \
--text "正在生成维码" \
--pulsate --auto-close --auto-kill
#------------------------------------------------------
mkdir -p /tmp/text123
exit 0
Copy the Code
Reply
Like 0
Favorite
View the author
All Replies
xiamingyu
deepin
2020-05-22 22:10
#1
还有什么有趣儿的脚本吗
Reply
Like 0
View the author
i8520
deepin
2020-05-22 22:42
#2
本帖最后由 i8520 于 2020-5-22 14:47 编辑
https://bbs.deepin.org/post/194861
还有什么有趣儿的脚本吗
有个创建启动文件的脚本 这个看起来很乱
#!/bin/bash
LANG="zh_CN.UTF-8"
#---窗口名称
title1="创建启动文件--在主目录(个人)下的--启动器文件夹"
text1="请输入启动文件名称"
text2_2="选择文件"
#参数不可用中文
boxlist="Internet|Chat|Music|Video|Graphics|Office|Development|System|Others"
KEYW_REQUEST_DLG_en="在主目录(个人)下的--启动器文件夹--链接到了桌面"
KEYW_REQUEST_DLG2_en="======重要提醒======"
###############################################################
#----NAME
get_name(){
zenity --entry --width=450 --title="$title1" --text="$text1"
}
name=$(get_name) || exit
while [ "$(expr match "$name" '.')" -lt "1" ]; do
zenity --entry --width=450 --title="$title1" --text="$text2_2"
name=$(get_name) || exit
done
#----EXEC
title3="选择脚本或程序--格式-->| .sh | .AppImage |"
exec=$(zenity --title="$title3" --file-selection)
#----ICON选择文件
title2="为启动器文件选择显示的图标--格式->| .png | .svg | .ioc |"
icon=$(zenity --title="$title2" --file-selection)
#----CATEG
text2_3="创建的启动器归属类别"
text2_4="请选择"
categ=$(zenity --forms --width=450 --title="$title1" --text="$text2_3" --add-combo="$text2_4" --combo-values="$boxlist")
#----KEYW
keyw=$(zenity --entry --width=450 --title="$KEYW_REQUEST_TIL_en" --entry-text="$KEYW_REQUEST_DLG_en" --text="$KEYW_REQUEST_DLG2_en")
#
if [ ! -d "$HOME/启动器文件" ]
then
mkdir ~/启动器文件
fi
cat > ~/启动器文件/${name}.desktop<
[Desktop Entry]
Version=1.0
Terminal=false
StartupNotify=false
Type=Application
Name=$name
Exec=$exec
Icon=$icon
Categories=${categ};
Keywords=${keyw};
EOT
chmod +x ~/启动器文件/${name}.desktop
chmod +x $exec
dedit ~/启动器文件/${name}.desktop
if [ ! -d "~/桌面/启动器文件" ]
then
ln -s ~/启动器文件 ~/桌面
fi
Copy the Code
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
WiFi Drivers
Popular Events
More
[给喜欢写脚本自娱自乐热] --- 文字转二维码
QarencodeQRcode.zip