1#!/bin/bash 2# Copyright (c) 2022 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15count=0 16coldTemp=-22000 17highTemp=40100 18output=/data/sensor/battery/temp 19 20while ((count < 100)) 21do 22 if [ $(($count%2)) == 0 ]; then 23 let "coldTemp = coldTemp + 1000" 24 echo $coldTemp 25 echo $coldTemp > $output 26 sleep 5 27 else 28 let "highTemp = highTemp + 1000" 29 echo $highTemp 30 echo $highTemp > $output 31 sleep 5 32 fi 33 let "count = count + 1" 34 cat $output 35done