Script Execution Methods Shell scripts are text files containing Linux commands executed by an interpreter. Using sh sh script.sh Direct Execution To execute a script directly: Begin the script with #!/bin/bash Grant execution permissions: chmod u+x script.sh ./script.sh This method internally uses...
The IFS (Intenral Field Separator) variable in shel scripting controls how the shell interprets word boundaries. By default, it includes space, tab, and newline characters. Modifying IFS allows for custom string segmentation. Setting IFS to IFS=$'\n':;" would make newline, colon, semicolon, and...
Hardware and Kernel Insigths uname -m # Display the system's CPU architecture uname -r # Output the active kernel release string dmidecode -q # Extract SMBIOS/DMI hardware component data hdparm -I /dev/sda # Retrieve detailed characteristics of a storage device hdparm -tT /dev/sda # Execute read-spe...
Toggling and Managing Internal Commands Internal shell commands can be disabled or enabled dynamical. Use enable -n to turn off a built-in and enable to restore it. [root@localhost opt]# enable -n cd [root@localhost opt]# cd /mnt/ [root@localhost opt]# After disabling cd, the command no longer funct...
Batch File Processing Example #!/bin/bash python preprocess_annotation.py -i wheat_annotation.gff3 -o wheat_annotation_filtered.gff4 base_fasta="wheat_transcripts.fasta" annotation_gff="wheat_annotation_filtered.gff4" motif_types=("G4" "C4" "A4" &quo...
Automated Service Startup with Password Authentication The following expect script handles services requiring sudo access: #!/usr/bin/expect set timeout 5 spawn mysql.server start echo "MySQL service started successfully" spawn sh /opt/app/tomcat/bin/shutdown.sh spawn sh /opt/app/tomcat/bi...