Pages

Monday, March 23, 2015

RHEL v7: write bash

Write a Bash script called prog.sh in the /root directory that creates 40 files of 2MB each with the fallocate command in the mounted /xfs directory. Each file has got a name as follows: .file_N where N is a number from 1 to 40.

cd /root
vi prog.sh
#!/bin/bash
cd /xfs
N=40
while [ “$N” -gt 0 ]
do
fallocate -l 2M .file_$N
N=`expr $N – 1`
done
——————–
# chmod u+x prog.sh
# ./prog.sh

No comments:

Post a Comment