Loading...
More Shell Posts
#!/bin/bash#cpcmd.sh [file1 [file2...]]#Prints out the commands needed to copy the file to your local machine#This will work on any server that also has the same hostname as in your hosts file.#I should update this to detect if a file is a directory, and enable recursion for those commands. If you do it now, it will probably just warn you.if [ -n "$1" ]; thenwhile [ -n "$1" ]; doprintf "scp \"$(whoami)@$(hostname):"printf `readlink -f $1`printf "\" .\n"shiftdoneelseecho "scp \"$(whoami)@$(hostname):$PWD/*\" ."fi#-----------EDIT:#On the UNT cell machines, you have to do this script instead#if [ -n "$1" ]; then# while [ -n "$1" ]; do# printf "scp $(whoami)@$(hostname).eng.unt.edu:"# printf `readlink -f $1`# printf " .\n"# shift# done#else# echo "scp $(whoami)@$(hostname).eng.unt.edu:$PWD/* ."#fi
// check versionnode -v || node --version// list installed versions of node (via nvm)nvm ls// install specific version of nodenvm install 6.9.2// set default version of nodenvm alias default 6.9.2// switch version of nodenvm use 6.9.1
#!/bin/bash# Set the directory to searchDIRECTORY="src"# Set the output fileOUTPUT_FILE="testids.txt"# Clear the output file> "$OUTPUT_FILE"# Find all .tsx files in the specified directory and its subdirectoriesfind "$DIRECTORY" -type f -name "*.tsx" | while read -r FILEdo# Search for instances of 'data-testid="testid"' and append them to the output filegrep -o 'data-testid="[^"]*"' "$FILE" >> "$OUTPUT_FILE"# Search for instances of "'data-testid': 'testid'" and append them to the output filegrep -o "'data-testid': '[^']*'" "$FILE" >> "$OUTPUT_FILE"doneecho "Search complete. Test IDs written to $OUTPUT_FILE."
#!/bin/bash# Turns 4 spaces into tabs.# Mostly stolen from AI# Define the directory to processDIRECTORY=$1TabCount=${2:-'4'} #Defaults to 4# Check if directory is specifiedif [ -z "$DIRECTORY" ]; thenecho "Error: Directory not specified."exit 1fi# Check if directory existsif [ ! -d "$DIRECTORY" ]; thenecho "Error: Directory does not exist."exit 1fi# Find all files in directory and subdirectoriesFILES=$(find "$DIRECTORY" -type f)# Loop through each file and unexpand itfor FILE in $FILES; dounexpand -t "$TabCount" "$FILE" > "$FILE.tmp"mv "$FILE.tmp" "$FILE"doneecho "Done!"
#!/bin/bash#Takes all the c and h files in the current directory and prints them#Yup, it's that easyfor file in *.h *.hpp *.c *.cpp; do#If it existsif [ -f "$file" ]; thenecho "//===============$file==============="cat $filefidone
#!/bin/bash#Takes command line arguments and pulls the header files.#Good for checking if the function you want is in the header or not.#cppToStdout.sh "time.h"while [ "$1" != "" ]; doecho "#include<$1>" | g++ -x c++ -E -shiftdone