ios - if , then command on deb file -
i want create deb file ios. created 3 command files on debian folder presint, postint , postrm. why code cannot function when install deb file?
#!/bin/bash if [ "/system/library/fonts/cache/applecoloremoji.ttf" ];then mv /system/library/fonts/cache/applecoloremoji.ttf /system/library/fonts/cache/applecoloremoji.backup elif [ "/system/library/fonts/cache/applecoloremoji@2x.ttf" ];then mv /system/library/fonts/cache/applecoloremoji@2x.ttf /system/library/fonts/cache/applecoloremoji@2x.backup elif [ "/system/library/fonts/cache/applecoloremoji@3x.ttf" ];then mv /system/library/fonts/cache/applecoloremoji@3x.ttf /system/library/fonts/cache/applecoloremoji@3x.backup else echo "cannot backup font" fi
i want command able find file inside dir , remane file backup.
you need -f flag in if-statement. -f flag tests file, see man test
possibilities.
i added var's make code easier read:
#!/bin/bash orgdir="/system/library/fonts/cache" # targetdir here equal orgdir, maybe want change in future. targetdir="/system/library/fonts/cache" # when orgdir or targetdir contains spaces, need double quotes, # in example not need them. # use double quotes habits if [ -f "${orgdir}/applecoloremoji.ttf" ]; mv "${orgdir}/applecoloremoji.ttf" "${targetdir}/applecoloremoji.backup" elif [ -f "${orgdir}/applecoloremoji@2x.ttf" ]; mv "${orgdir}/applecoloremoji@2x.ttf" "${targetdir}/applecoloremoji@2x.backup" elif [ -f "${orgdir}/applecoloremoji@3x.ttf" ]; mv "${orgdir}/applecoloremoji@3x.ttf" "${targetdir}/applecoloremoji@3x.backup" else echo "cannot backup font" fi
Comments
Post a Comment