⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pad.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# pad.sh#######################################################               PAD (xml) file creator#+ Written by Mendel Cooper &lt;thegrendel@theriver.com&gt;.#+ Released to the Public Domain.##  Generates a "PAD" descriptor file for shareware#+ packages, according to the specifications#+ of the ASP.#  http://www.asp-shareware.org/pad####################################################### Accepts (optional) save filename as a command-line argument.if [ -n "$1" ]then  savefile=$1else  savefile=save_file.xml               # Default save_file name.fi  # ===== PAD file headers =====HDR1="&lt;?xml version=\"1.0\" encoding=\"Windows-1252\" ?&gt;"HDR2="&lt;XML_DIZ_INFO&gt;"HDR3="&lt;MASTER_PAD_VERSION_INFO&gt;"HDR4="\t&lt;MASTER_PAD_VERSION&gt;1.15&lt;/MASTER_PAD_VERSION&gt;"HDR5="\t&lt;MASTER_PAD_INFO&gt;Portable Application Description, or PADfor short, is a data set that is used by shareware authors todisseminate information to anyone interested in their software products.To find out more go to http://www.asp-shareware.org/pad&lt;/MASTER_PAD_INFO&gt;"HDR6="&lt;/MASTER_PAD_VERSION_INFO&gt;"# ============================fill_in (){  if [ -z "$2" ]  then    echo -n "$1? "     # Get user input.  else    echo -n "$1 $2? "  # Additional query?  fi    read var             # May paste to fill in field.                       # This shows how flexible "read" can be.  if [ -z "$var" ]  then    echo -e "\t\t<$1 />" >>$savefile    # Indent with 2 tabs.    return  else    echo -e "\t\t<$1>$var</$1>" >>$savefile    return ${#var}     # Return length of input string.  fi}    check_field_length ()  # Check length of program description fields.{  # $1 = maximum field length  # $2 = actual field length  if [ "$2" -gt "$1" ]  then    echo "Warning: Maximum field length of $1 characters exceeded!"  fi}  clear                  # Clear screen.echo "PAD File Creator"echo "--- ---- -------"echo# Write File Headers to file.echo $HDR1 >$savefileecho $HDR2 >>$savefileecho $HDR3 >>$savefileecho -e $HDR4 >>$savefileecho -e $HDR5 >>$savefileecho $HDR6 >>$savefile# Company_Infoecho "COMPANY INFO"CO_HDR="Company_Info"echo "<$CO_HDR>" >>$savefilefill_in Company_Namefill_in Address_1fill_in Address_2fill_in City_Town fill_in State_Provincefill_in Zip_Postal_Codefill_in Country# If applicable:# fill_in ASP_Member "[Y/N]"# fill_in ASP_Member_Number# fill_in ESC_Member "[Y/N]"fill_in Company_WebSite_URLclear   # Clear screen between sections.   # Contact_Infoecho "CONTACT INFO"CONTACT_HDR="Contact_Info"echo "<$CONTACT_HDR>" >>$savefilefill_in Author_First_Namefill_in Author_Last_Namefill_in Author_Emailfill_in Contact_First_Namefill_in Contact_Last_Namefill_in Contact_Emailecho -e "\t</$CONTACT_HDR>" >>$savefile   # END Contact_Infoclear   # Support_Infoecho "SUPPORT INFO"SUPPORT_HDR="Support_Info"echo "<$SUPPORT_HDR>" >>$savefilefill_in Sales_Emailfill_in Support_Emailfill_in General_Emailfill_in Sales_Phonefill_in Support_Phonefill_in General_Phonefill_in Fax_Phoneecho -e "\t</$SUPPORT_HDR>" >>$savefile   # END Support_Infoecho "</$CO_HDR>" >>$savefile# END Company_Infoclear# Program_Info echo "PROGRAM INFO"PROGRAM_HDR="Program_Info"echo "<$PROGRAM_HDR>" >>$savefilefill_in Program_Namefill_in Program_Versionfill_in Program_Release_Monthfill_in Program_Release_Dayfill_in Program_Release_Yearfill_in Program_Cost_Dollarsfill_in Program_Cost_Otherfill_in Program_Type "[Shareware/Freeware/GPL]"fill_in Program_Release_Status "[Beta, Major Upgrade, etc.]"fill_in Program_Install_Supportfill_in Program_OS_Support "[Win9x/Win2k/Linux/etc.]"fill_in Program_Language "[English/Spanish/etc.]"echo; echo  # File_Info echo "FILE INFO"FILEINFO_HDR="File_Info"echo "<$FILEINFO_HDR>" >>$savefilefill_in Filename_Versionedfill_in Filename_Previousfill_in Filename_Genericfill_in Filename_Longfill_in File_Size_Bytesfill_in File_Size_Kfill_in File_Size_MBecho -e "\t</$FILEINFO_HDR>" >>$savefile  # END File_Info clear  # Expire_Info echo "EXPIRE INFO"EXPIRE_HDR="Expire_Info"echo "<$EXPIRE_HDR>" >>$savefilefill_in Has_Expire_Info "Y/N"fill_in Expire_Countfill_in Expire_Based_Onfill_in Expire_Other_Infofill_in Expire_Monthfill_in Expire_Dayfill_in Expire_Yearecho -e "\t</$EXPIRE_HDR>" >>$savefile  # END Expire_Info clear  # More Program_Infoecho "ADDITIONAL PROGRAM INFO"fill_in Program_Change_Infofill_in Program_Specific_Categoryfill_in Program_Categoriesfill_in Includes_JAVA_VM "[Y/N]"fill_in Includes_VB_Runtime "[Y/N]"fill_in Includes_DirectX "[Y/N]"  # END More Program_Infoecho "</$PROGRAM_HDR>" >>$savefile# END Program_Info clear# Program Descriptionecho "PROGRAM DESCRIPTIONS"PROGDESC_HDR="Program_Descriptions"echo "<$PROGDESC_HDR>" >>$savefileLANG="English"echo "<$LANG>" >>$savefilefill_in Keywords "[comma + space separated]"echoecho "45, 80, 250, 450, 2000 word program descriptions"echo "(may cut and paste into field)"#  It would be highly appropriate to compose the following#+ "Char_Desc" fields with a text editor,#+ then cut-and-paste the text into the answer fields.echoecho "              |---------------45 characters---------------|"fill_in Char_Desc_45check_field_length 45 "$?"echofill_in Char_Desc_80check_field_length 80 "$?"fill_in Char_Desc_250check_field_length 250 "$?"fill_in Char_Desc_450fill_in Char_Desc_2000echo "</$LANG>" >>$savefileecho "</$PROGDESC_HDR>" >>$savefile# END Program Descriptionclearecho "Done."; echo; echoecho "Save file is:  \""$savefile"\""exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -