# properties **Repository Path**: mail_osc/properties ## Basic Information - **Project Name**: properties - **Description**: shell 命令快速操作 properties 文件,进行读、写操作。 - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-08-10 - **Last Updated**: 2025-04-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shell中进行properties文件读写操作 注意,需要JDK环境。当前测试是JDK1.8,其他版本应该也行 ### 快速使用 ##### 第一步,下载应用文件 ```` wget down.zvo.cn/properties/properties-1.1.jar -O ~/properties.jar ```` ##### 修改操作 修改 /root/test.properties 文件中的 database.ip 如果 /root/test.properties 文件不存在,则会自动创建 ```` java -cp ~/properties.jar Properties -path=/root/test.properties -set database.ip=127.0.0.1 ```` ##### 读取操作 读取 /root/test.properties 中的 database.ip 的值,赋予Shell 的变量 databaseip ```` databaseip=`java -cp ~/properties.jar Properties -path=/root/test.properties -get database.ip` echo $databaseip ```` ### 查看所有支持的命令 ```` java -cp ~/properties.jar Properties ```` 即可看到: ```` common operation: -path set properties file absolute path. for example : -path=/root/test.properties -set update properties file. if file not find, create. for example : -set database.ip=127.0.0.1 -get gain properties value. for example : -get database.ip ------ for example ----- java -cp properties.jar Properties -path=/root/test.properties -set database.ip=127.0.0.1 ````