Skip to content

Instantly share code, notes, and snippets.

@kennyyu kennyyu/edit.sh

Created Sep 20, 2013
Embed
What would you like to do?
edit N random files
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: $0 N"
exit 1
fi
N=$1
files=$(find /home/passifist/linux-2.4.29 | grep "\.[ch]")
files=$(shuf --echo $files)
arr=($files)
sliced=("${arr[@]:0:$N}")
for file in "${sliced[@]}"
do
echo -e "\n// MY COOL EDITS" >> $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.