Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

WGU D 848 Scripting Examples for Pen Test: Bash, PowerShell, Python Western Governors University LATES 2026

Puntuación
-
Vendido
-
Páginas
3
Grado
A+
Subido en
15-07-2026
Escrito en
2025/2026

Bash Variable Here’s our birthday cake price script in Bash: #!/bin/bash birthdaycake=2 birthdaycake =$(( birthdaycake / 2 )) echo The price of a birthday cake is $ birthdaycake When we run this code, we get the following result: The price of a birthday cake is 1 The = operator assigns a value to the variable. The $ operator before the variable name references the value stored in that variable. The double parenthesis (( )) tells Bash we are performing a calculation example divide birthdaycake/2 Bash Array dates=(1,2,5,16,23,25,28) date [0] The date[0] would give us the value of 1 from our array above. #!/bin/bash dates=(1,2,5,16,23,25,28) echo 'The third day offering a discount is: ' ${dates[2]} The script will produce the following output: The third day offering a discount is 5 When referencing an array in Bash we use the {} curly braces. Note: Bash uses zero-indexing which means when counting elements in an array, you start with 0. Therefore when dates[2] this would be the 3rd position in the array; as 1 would be in position 0, 2 would be in position 1, and 5 would be in position 2 (where our script points). WGU D 848 Scripting Examples for Pen Test: Bash, PowerShell, Python Scripting Language Operating System Example How to run PowerShell Windows (originally) Mac Linux Write-Host "Hello, world!" .1 Hello, World! PowerShell Variable Here’s our birthday cake price script in PowerShell: $ birthdaycake _price = 2.00 $ birthdaycake _price = $ birthdaycake _price / 2 Write-Host "The price of a birthday cake is" $ birthdaycake _price When we run this script, we get the following result: The price of a birthday cake is 1 PowerShell Array $dates=1,2,5,16,23,25,28 Write-Host 'The third day offering a discount is: ' $dates[2] The script will produce the following output: 'The third day offering a discount is: 5 Here we access the array element by using the array name and placing our index point is square brackets [].

Mostrar más Leer menos
Institución
Wgu
Grado
D 848

Vista previa del contenido

WGU D 848 Scripting Examples for Pen
Test: Bash, PowerShell, Python
Operating Example How to run
System
Bash Linux #!/bin/bash chmod u+x hello.sh
Mac echo "Hello, world!" ./hello.sh
Hello, World!
Bash Variable
Here’s our birthday cake price script in Bash:
#!/bin/bash
birthdaycake=2
birthdaycake =$(( birthdaycake / 2 ))
echo The price of a birthday cake is $ birthdaycake

When we run this code, we get the following result:
The price of a birthday cake is 1

The = operator assigns a value to the variable.
The $ operator before the variable name references the value stored in that variable.
The double parenthesis (( )) tells Bash we are performing a calculation
example divide birthdaycake/2

Bash Array
dates=(1,2,5,16,23,25,28)
date [0]
The date[0] would give us the value of 1 from our array above.

#!/bin/bash
dates=(1,2,5,16,23,25,28)
echo 'The third day offering a discount is: ' ${dates[2]}

The script will produce the following output:
The third day offering a discount is 5

When referencing an array in Bash we use the {} curly braces.
Note: Bash uses zero-indexing which means when counting elements in an array, you start with
0. Therefore when dates[2] this would be the 3rd position in the array; as 1 would be in position 0,
2 would be in position 1, and 5 would be in position 2 (where our script points).

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
15 de julio de 2026
Número de páginas
3
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$13.49
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Brainarium Delaware State University
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1969
Miembro desde
3 año
Número de seguidores
1045
Documentos
23691
Última venta
6 horas hace

3.8

333 reseñas

5
155
4
63
3
57
2
16
1
42

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes