mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-04 06:24:07 +08:00
impr(quotes): added code_bash quotes (@thesomewhatyou) (#7076)
### Description Added some basic code_bash quotes. ### Checks - [x] Adding quotes? - [N/A] Make sure to include translations for the quotes in the description (or another comment) so we can verify their content. That's pretty much it to be fair.
This commit is contained in:
parent
946f41835f
commit
318da6e61d
1 changed files with 71 additions and 0 deletions
71
frontend/static/quotes/code_bash.json
Normal file
71
frontend/static/quotes/code_bash.json
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"language": "code_bash",
|
||||
"groups": [
|
||||
[0, 100],
|
||||
[101, 300],
|
||||
[301, 600],
|
||||
[601, 9999]
|
||||
],
|
||||
"quotes": [
|
||||
{
|
||||
"text": "echo \"Hello, World!\"",
|
||||
"source": "Basic Hello World in Bash",
|
||||
"length": 20,
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# This script prints numbers from 1 to 10\nfor i in {1..10}\ndo\n echo $i\ndone",
|
||||
"source": "Looping through numbers in Bash",
|
||||
"length": 89,
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Check if a file exists\nFILE=\"/path/to/file.txt\"\nif [ -f \"$FILE\" ]; then\n echo \"$FILE exists.\"\nelse\n echo \"$FILE does not exist.\"\nfi",
|
||||
"source": "File existence check in Bash",
|
||||
"length": 148,
|
||||
"id": 3
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Read user input\necho \"Enter your name:\"\nread NAME\necho \"Hello, $NAME!\"",
|
||||
"source": "Reading user input in Bash",
|
||||
"length": 85,
|
||||
"id": 4
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Function to greet a user\ngreet() {\n echo \"Hello, $1!\"\n}\n\ngreet \"Alice\"",
|
||||
"source": "Defining and using functions in Bash",
|
||||
"length": 86,
|
||||
"id": 5
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Using command line arguments\necho \"Script name: $0\"\necho \"First argument: $1\"\necho \"Second argument: $2\"",
|
||||
"source": "Using command line arguments in Bash",
|
||||
"length": 119,
|
||||
"id": 6
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Simple case statement\necho \"Enter a number between 1 and 3:\"\nread NUM\ncase $NUM in\n 1)\n echo \"You entered one.\" ;;\n 2)\n echo \"You entered two.\" ;;\n 3)\n echo \"You entered three.\" ;;\n *)\n echo \"Invalid input.\" ;;\nesac",
|
||||
"source": "Using case statements in Bash",
|
||||
"length": 246,
|
||||
"id": 7
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Create a new directory\nNEW_DIR=\"/path/to/new_directory\"\nmkdir -p \"$NEW_DIR\"\necho \"Directory $NEW_DIR created successfully.\"",
|
||||
"source": "Creating a new directory in Bash",
|
||||
"length": 138,
|
||||
"id": 8
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Backup a directory\nSOURCE_DIR=\"/path/to/source\"\nBACKUP_DIR=\"/path/to/backup\"\ntar -czf \"$BACKUP_DIR/backup_$(date +%F).tar.gz\" -C \"$SOURCE_DIR\" .",
|
||||
"source": "Backing up a directory in Bash",
|
||||
"length": 159,
|
||||
"id": 9
|
||||
},
|
||||
{
|
||||
"text": "#!/bin/bash\n\n# Monitor disk usage\ndf -h | grep '^/dev/' | while read line; do\n USAGE=$(echo $line | awk '{print $5}' | sed 's/%//')\n if [ $USAGE -gt 80 ]; then\n echo \"Warning: Disk usage is at ${USAGE}%\"\n fi\ndone",
|
||||
"source": "Monitoring disk usage in Bash",
|
||||
"length": 218,
|
||||
"id": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue