Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash check if file empty

#!/bin/bash -e

if [ -s diff.txt ]; then
        # The file is not-empty.
        rm -f empty.txt
        touch full.txt
else
        # The file is empty.
        rm -f full.txt
        touch empty.txt
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: emogi app linux 
Shell :: linux remove all from current directory 
Shell :: aws connect to eks cluster 
Shell :: sudo apt uninstall 
Shell :: git reset back to previous pushed commit 
Shell :: linux process holding deleted file 
Shell :: check gcc version 
Shell :: generate patch file git 
Shell :: linux unzip with password 
Shell :: export requirements from python venv 
Shell :: git download specific commit 
Shell :: list all running processes linux 
Shell :: jupyter python downkload 
Shell :: bash do multiple times 
Shell :: install pgcli linux 
Shell :: get repository url git cil 
Shell :: npm uninstall 
Shell :: centos web panel install 
Shell :: bash store file lines in variable 
Shell :: optimize github repo 
Shell :: git change commit id email 
Shell :: setup ngrok in windows subsystem for linux 
Shell :: cudatoolkit installation 
Shell :: bash remove first line 
Shell :: bash math expression 
Shell :: create virtual environment anaconda 
Shell :: visual studio code ubuntu 
Shell :: tar.gz extract 
Shell :: sudo cd command not found 
Shell :: add local repository to remote 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =