Applescript需要修剪打印线
我有台词Applescript需要修剪打印线,applescript,Applescript,我有台词 将usedSpace设置为整数(将shell脚本“df-hl | grep'disk1'| awk print$5}') 它给我带%的数字,但我只需要不带%的数字。如果字符串中有非数字字符,则无法将文本值转换为AppleScript中的数字。首先必须删除不需要的字符,然后转换: set usedSpace to (do shell script "df -hl | grep 'disk1' | awk '{ print $5}'") set numberOnly to charac
将usedSpace设置为整数(将shell脚本“df-hl | grep'disk1'| awk print$5}')
它给我带%的数字,但我只需要不带%的数字。如果字符串中有非数字字符,则无法将文本值转换为AppleScript中的数字。首先必须删除不需要的字符,然后转换:
set usedSpace to (do shell script "df -hl | grep 'disk1' | awk '{ print $5}'")
set numberOnly to characters 1 thru -2 of usedSpace as text as number