This commit is contained in:
Yavuz Sava 2025-02-02 18:33:59 +03:00
parent b835b2e38a
commit 80c8e87369

View File

@ -214,6 +214,91 @@
"source": [
"# Creating Bash scripts"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!/bin/bash\n",
"echo \"Starting at: $(date)\"\n",
"echo\n",
"\n",
"echo \"UPTIME\"\n",
"uptime\n",
"echo\n",
"\n",
"echo \"FREE\"\n",
"free\n",
"echo\n",
"\n",
"echo \"WHO\"\n",
"who\n",
"echo\n",
"\n",
"echo \"Finishing at: $(date)\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!/bin/bash\n",
"\n",
"echo \"Starting at: $(date)\"; echo\n",
"echo \"UPTIME\"; uptime; echo\n",
"echo \"FREE\"; free; echo\n",
"echo \"WHO\"; who; echo\n",
"echo \"Finishing at: $(date)\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using variables and globs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"example=hello\n",
"echo $example"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!/bin/bash\n",
"\n",
"line=\"-------------------------------------------------\"\n",
"echo \"Starting at: $(date)\"; echo $line\n",
"echo \"UPTIME\"; uptime; echo $line\n",
"echo \"FREE\"; free; echo $line\n",
"echo \"WHO\"; who; echo $line\n",
"echo \"Finishing at: $(date)\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"echo *.py\n",
"echo c*\n",
"echo *\n",
"echo ?????.py"
]
}
],
"metadata": {