روابط کو نئے ٹیب میں کھوليں
    • کام کی رپورٹ
    • ای میل
    • دوبارہ لکھیں
    • تقریر
    • عنوان جنریٹر
    • اسمارٹ جواب
    • نظم
    • مقالہ
    • لطیفہ
    • Instagram پوسٹ
    • X پوسٹ
    • Facebook پوسٹ
    • سٹوری
    • تعارفی خط
    • نصاب حیات
    • جاب کی تفصیل
    • سفارشی خط
    • استعفیٰ کا خط
    • دعوت کا خط
    • مبارکباد کا پیغام
    • مزید سانچے آزمائیں
  1. Bash scripting is a powerful tool for automating tasks in Unix-like operating systems. Below are some examples to help you get started with writing and executing bash scripts.

    Hello World Script

    A simple script to print "Hello World":

    #!/bin/bash
    echo "Hello World"
    نقل کر لیا گیا!

    This script uses the echo command to print the message to the console.

    Defining Variables

    You can define and use variables in bash scripts:

    #!/bin/bash
    name="Tom"
    age=12
    echo "$name's age is $age"
    نقل کر لیا گیا!

    This script assigns values to variables and prints them using the echo command.

    Environment Variables

    Accessing environment variables in a script:

    #!/bin/bash
    echo $HOME # Prints the home directory of the current user
    echo $PATH # Prints the directories in which the shell searches for executable files
    نقل کر لیا گیا!

    This script prints the values of the HOME and PATH environment variables.

    Taking User Input

    Using the read command to take user input:

    #!/bin/bash
    read -p "Enter a number: " num
    echo "You entered: $num"
    نقل کر لیا گیا!
  2. 9 Bash Script Examples to Get You Started on Linux

    For the shell to execute a script, the script must have the executable filepermission set. Without this, your script is just a text file. With it, it's still a text file, but the shell knows i…
    What's That Strange First Line?

    The first line of a script tells the shell which interpreter should be called to run that script. The first line must start with a shebang, "#!", also known as a hashbang. The "#!" tells the shell that this line contains the path and name of the interpreter that t…

    Printing Text

    Writing text to the terminal is a common requirement. A bit of visual feedback goes a long way. For simple messages, the echo command will suffice. It allows some formatting of the text and lets you work with variables too. The printf commandgiv…

  3. 50 Bash Scripting Examples (PART-1) - TecAdmin

    26 اپریل، 2025 · Learn how to write and execute bash scripts with 50 examples covering basic commands, variables, user input, and if-else statements. Bash scripting is a powerful tool for automating tasks on …

  4. لوگ بھی پوچھتے ہیں