About 4,630,000 results
Open links in new tab
  1. linux - How to expand relative paths in shell script - Stack Overflow

    Jul 23, 2012 · There's a little trick you can use to get the absolute path from a relative path without changing the present working directory. The trick is to move to the relative path in a subshell, …

  2. Traverse all subdirectories in and do something in Unix shell script

    Nov 25, 2018 · I want my shell script to visit all subdirectories in a main directory. Do something in directories, sent output to a spool file and move on to next directory. Consider Main Dir = /tmp …

  3. Loop through directories and subdirectories in bash

    Sep 14, 2018 · I tried with this line, starting at the parent folder containing the folders I want to loop through: for dir in */; do cd $dir for dir2 in */; do cd $dir2 ls -d $PW...

  4. How to Walk Through a Directory Structure in a Shell Script

    Mar 18, 2024 · In this script, we use a for loop with ./*/ to iterate over subdirectories of the current directory. The ./*/ is a glob pattern that comprises the ./ current directory and the */ matches all …

  5. Shell Script to Run Commands to All Subdirectories

    Aug 2, 2012 · Here's my script: grep -A 1 "Drive Model" sysconfig.out | tail -1 >> /home/xtee/sst-logs.out. grep -m 1 "Pair0 DIMM0" node0/trans_file_prev/*setupsys* | tail -1 >> /home/xtee/sst …

  6. How to execute a script within a subfolder of a directory in path

    Apr 3, 2021 · sub_folder/script.sh() { ~/test_path/sub_folder/script.sh "$@"; } and then either use export -f sub_folder/script.sh (so bash subprocesses inherit it), or do this in a wrapper script …

  7. linux - Looping Through Subdirectories and Running a Command

    I have a set of repositories sorted into directories based on their VCS (Git, Mercurial, SVN). With Subversion I was able to run svn update * in the parent directory and it would loop through …

  8. How to Run a command on all subfolders - Unix & Linux Stack Exchange

    Jul 8, 2016 · The usual method for changing the working directory for a simple command is to put the cd and to invocation of the command in a sub-shell. The working directory will be changed …

  9. Change working directory in shell script - Linux.org

    Feb 7, 2020 · A symbolic link is like a shortcut - it can point to a file, or a directory. With the -L parameter- ls -FL $1 will dereference any sym-links it finds and then append a "/" at the end if …

  10. Bash script to create multiple directories and Subdirectories

    Aug 14, 2012 · I'm currently using the following two scripts to create multiple directories and subdirectories. The first script creates '/Dir1/Dir2' and the second script then adds multiple …

  11. Some results have been removed
Refresh