mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-06-02 16:09:56 -04:00
initial commit
This commit is contained in:
parent
2090c6fa97
commit
05a1b863a6
487 changed files with 114253 additions and 0 deletions
36
VBLADE/vblade-master/sparsefile
Normal file
36
VBLADE/vblade-master/sparsefile
Normal file
|
@ -0,0 +1,36 @@
|
|||
#! /bin/sh
|
||||
# sparsefile - create sparse files conveniently
|
||||
#
|
||||
# depends on dd and dc commands.
|
||||
|
||||
usage() {
|
||||
echo "usage: `basename $0` {10M|10G|10T} {filename}" 1>&2
|
||||
}
|
||||
size=$1
|
||||
if test "$size" = "-h"; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
fnam=$2
|
||||
|
||||
die() {
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
set -e
|
||||
units=`echo "$size" | sed 's!.*\(.\)$!\1!'`
|
||||
n=`echo "$size" | sed 's!\(.*\).$!\1!'`
|
||||
test "$units" && test "$n" && test "$units" != "$n" || die
|
||||
case "$units" in
|
||||
M)
|
||||
seek=`echo "$n 1024 * 1 - p" | dc` ;;
|
||||
G)
|
||||
seek=`echo "$n 1024 1024 * * 1 - p" | dc` ;;
|
||||
T)
|
||||
seek=`echo "$n 1024 1024 1024 * * * 1 - p" | dc` ;;
|
||||
*)
|
||||
die
|
||||
;;
|
||||
esac
|
||||
sh -xc "dd bs=1k count=1 if=/dev/zero of=$fnam seek=$seek"
|
||||
ls -lh "$fnam"
|
Loading…
Add table
Add a link
Reference in a new issue