I want to write a script that creates a file that stores the hostname and date in YEARMONTHDAYHOURMINSEC  and prints all the enviroment variables in the system and delete all the previously created files in the directory if any or else create a new file. So the script should search through the directory and delete the previous file in that pattern but should not delete other files.#!/bin/bashtime=$(date +%Y%m%d%H%M%S)echo $(hostname) >>env.$time.txtecho date:$time >>env.$time.txtecho $(env)>>env.$time.txtcat env.$time.txt
script which creates a filename in certain pattern and deletes any previously created files in the same pattern if any?
linux;shell script