first off: you don't need the "cd" statement at all. And secondly, you should NEVER EVER iterate through an unknown directory with a for-loop: if the number of directory entries becomes higher you will execeed the maximum command line length and your script will fail. write it the following way:
Another problem is the "./search.sh" you mention at the end of your code snippet. You know that you are in some arbitrary directory and not the one you have started the script in, yes?
Hello there,
As a newbie:
The directories in PATH can be hard to distinguish when printed out as
one line with colon .Please, can i have a sample script to display
them,one to a line.
Thank you. (1 Reply)
Hi everyone.
I need to write a script which will download files/folders (a huge collection) to the local file server (centOS 4.4 Server),
and check regularly (every 6 hours or so if any new files are present, or if the old ones were modified to update contents).
Any insights on how to tackle... (2 Replies)
Hi,
root@server] df -h
121G 14G 101G 12% /home
147G 126G 14G 91% /backup
We having our site files and images are storing in
/backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following.
root@server] cd /home... (1 Reply)
Hello
I have a directory structure with year in format 4 digits, e.g 2009, below which is month format 1 or 2 digits, e.g 1 or 12, blow which is day format 1 or 2 digits, e.g 1 or 31.
I want to change the names of lots of directories to the be
Year - 4 digits , e.g 2009 - No change here... (4 Replies)
I need some help recovering from a "slight" screwup. We just moved 3 TB of data from one RAID Array to another. Low lever archive files. This was done with a regular cp (for some reason) and now we have lost all the timestamps on the files, and we urgently need to get the timestamps back on these... (7 Replies)
How can I change the cron entries only for ABC and XYZ from dosomething_1.0.sh to nowchanged_2.0 using a bash script ?
Any help will be appreciated.
#
# ABC
00,05,10,15,20,25,30,35,40,45,50,55 * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#
#
##
# DEF... (4 Replies)
Hi,
I have a command in my bash script, searchDirectoryName.sh:
DIR_NAME=$(find . -type d)
echo "${DIR_NAME}"
.
./Dir1
./Dir1/1.0.2.1
./Dir2
./Dir2/1.1
./Dir3
./Dir3/2.2.1
How can I select only following directory names with second subdirectoies and without first ./ in the... (3 Replies)
Hello Guys
I have a script working fine on csh, but I would like to change it to bash, how I should change this command to be able to work as bash script. :wall:
if ( $fsw > "0" ) then
foreach swath ( `awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }'` )
## work to be done... (2 Replies)
#!/bin/bash
X=$(</home/cogiz/computerhand.txt) # (3S 8C 2H 6D QC 8S 4H 5H)
Y=$(</home/cogiz/topcardinplay.txt) # KS
A=( "${Y::1}" )
B=( "${Y:1}" )
for e in ${X}; do
if ]; then # searching for valid cards K,S or 8
... (0 Replies)
I am trying to change dates in a bash script.
I have a start time and an endtime and want to increment the times. Basically
the month and day have to be incremented in a loop to create two strings, stm and
etm defining the start and end times.
stm="2014-05-13T00:00:00"... (4 Replies)
Discussion started by: novilatte
4 Replies
LEARN ABOUT DEBIAN
git-sh-setup
GIT-SH-SETUP(1) Git Manual GIT-SH-SETUP(1)NAME
git-sh-setup - Common git shell script setup code
SYNOPSIS
. "$(git --exec-path)/git-sh-setup"
DESCRIPTION
This is not a command the end user would want to run. Ever. This documentation is meant for people who are studying the Porcelain-ish
scripts and/or are writing new ones.
The git sh-setup scriptlet is designed to be sourced (using .) by other shell scripts to set up some variables pointing at the normal git
directories and a few helper shell functions.
Before sourcing it, your script should set up a few variables; USAGE (and LONG_USAGE, if any) is used to define message given by usage()
shell function. SUBDIRECTORY_OK can be set if the script can run from a subdirectory of the working tree (some commands do not).
The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables, but does not export them to the environment.
FUNCTIONS
die
exit after emitting the supplied error message to the standard error stream.
usage
die with the usage message.
set_reflog_action
set the message that will be recorded to describe the end-user action in the reflog, when the script updates a ref.
git_editor
runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or EDITOR) on a given file, but error out if no editor is specified
and the terminal is dumb.
is_bare_repository
outputs true or false to the standard output stream to indicate if the repository is a bare repository (i.e. without an associated
working tree).
cd_to_toplevel
runs chdir to the toplevel of the working tree.
require_work_tree
checks if the current directory is within the working tree of the repository, and otherwise dies.
require_work_tree_exists
checks if the working tree associated with the repository exists, and otherwise dies. Often done before calling cd_to_toplevel, which
is impossible to do if there is no working tree.
require_clean_work_tree <action> [<hint>]
checks that the working tree and index associated with the repository have no uncommitted changes to tracked files. Otherwise it emits
an error message of the form Cannot <action>: <reason>. <hint>, and dies. Example:
require_clean_work_tree rebase "Please commit or stash them."
get_author_ident_from_commit
outputs code for use with eval to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.
GIT
Part of the git(1) suite
Git 1.7.10.4 11/24/2012 GIT-SH-SETUP(1)