forked from KevinVandy/mantine-react-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash.sh
More file actions
executable file
·23 lines (19 loc) · 778 Bytes
/
bash.sh
File metadata and controls
executable file
·23 lines (19 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Define the directory to search in. Change this to your specific directory.
SEARCH_DIR="./apps/mantine-react-table-docs/examples/"
# Define the text to be added
TEXT="import '@mantine/core/styles.css';
import '@mantine/dates/styles.css';"
# Find all files named TS.tsx and append the text to the beginning of each file
find "$SEARCH_DIR" -type f -name "Legacy.tsx" | while read -r file; do
# Check if the file already contains the line to avoid duplicate insertion
echo "Processing $file"
if ! grep -qxF "$TEXT" "$file"; then
# Use a temporary file to prepend the text
temp_file=$(mktemp)
echo "$TEXT" > "$temp_file"
cat "$file" >> "$temp_file"
mv "$temp_file" "$file"
fi
done
echo "Processing complete."