I wouldn't test for filenames containing spaces, tabs, or newlines, I'd just write code that works even if they are present. (And if I found users creating filenames containing whitespace characters, I'd ban them from using my system! Unfortunately, there need to be exceptions for some things like .mp3 and .mp4 files with spaces in the titles of songs and movies, but most users creating filenames containing spaces are just trying to create problems for inexperienced programmers.)
Stop trying to create lists and then trying to process the list. Process filenames one at a time. And, learn to use shell built-ins instead of pipelines of awk, grep, and ls commands. Try something more like:
If you don't understand how something in the above works, try running it with:
and watch how bash processes each command in the script. If you still don't understand, ask questions... We're here to help you learn.
I've made a habit of including a four-letter "tail" on image file names I download from the Web, so I can both match them with IPTC Transmission References of my own making and rename them later using either a GUI renamer or a script I've written myself. Now I want to automate the process of... (2 Replies)
Hi all,
I'm trying to get a bash script working for a program (bowtie) which takes a list of input files (*.fastq) and assembles them to an output file (outfile.sam). All the .fastq files are in one folder in my home directory (~/infiles).
The problem is that the 'bowtie' requires that... (7 Replies)
Hi,
I do little bash scripting so sorry for my ignorance.
How do I compare if the two variable not match and if they do not match run a command.
I was thinking a for loop but then I need another for loop for the 2nd list and I do not think that would work as in the real world there could... (2 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
I've been trying to have an array of ip addresses go through a loop one at a time. Then compare if the current element is in another array of ip addresses. I've traced my error with /bin/bash -x
+ for c in '"${ip}"'
./netk5: line 65: 50.17.231.23 23.64.146.110 23.64.159.139 107.14.36.129... (17 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 Friends
please help me to create script to compare 2 fiile which has rpm info .
File 1:
glibc-2.12.1.149.el6_6.5.x86_64.rpm
glibc-common-2.12-1.149.el6_6.5.x86_64.rpm
File 2 :
glibc-2.12.123.el6_6.5.x86_64.rpm
glibc-common-2.12-123.el6_6.5.x86_64.rpm
To compare file1... (1 Reply)
I'm running on a staging server. I will need to use expect and I think ssh or scp to the other boxes.
I need to see something like this....Enter:Host 1
Enter:Host 2
Enter full directory path to compare: example /apps/acd/jboss-customer1/
Enter User Id:
Enter Password:
( Assumes... (6 Replies)
Hello,
i have a script that should compare between ${ARRAY}
that contains all fstab record like this :
>>echo ${ARRAY}
/ /boot
between all mountpoints in my df that is stord in ${ARRAY2}
>>echo ${ARRAY2}
/ /boot /dev/shm /var/spool/asterisk/monitor
now i have this loop:
for i in... (6 Replies)
Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies
LEARN ABOUT DEBIAN
git-sh
GIT-SH(1)GIT-SH(1)NAME
git-sh -- a git shell
SYNOPSIS
git-sh
DESCRIPTION
git-sh starts an interactive bash(1) session modified for git-heavy workflows. Typical usage is to change into the directory of a git work
tree or bare repository and run the git-sh command to start an interactive shell session.
Top-level command aliases are created for all core git(1) subcommands, git-sh builtin aliases (see BUILTIN ALIASES), and git command
aliases defined in ~/.gitconfig.
BUILTIN ALIASES
git-sh loads a set of standard aliases in addition to all core git commands. The builtin aliases are overridden by aliases defined in the
user or system gitconfig files.
a git add
b git branch
c git checkout
d git diff
f git fetch --prune
k git cherry-pick
l git log --pretty=oneline --abbrev-commit
n git commit --verbose --amend
r git remote
s git commit --dry-run --short
t git diff --cached
The Staging Area
a git add
aa git add --update (mnemonic: "add all")
stage git add
ap git add --patch
p git diff --cached (mnemonic: "patch")
ps git diff --cached --stat (mnemonic: "patch stat")
unstage
git reset HEAD
Commits and Commit History
ci git commit --verbose
ca git commit --verbose --all
amend git commit --verbose --amend
n git commit --verbose --amend
k git cherry-pick
re git rebase --interactive
pop git reset --soft HEAD^
peek git log -p --max-count=1
Fetching and Pulling
f git fetch
pm git pull (mnemonic: "pull merge")
pr git pull --rebase (mnemonic: "pull rebase")
Miscellaneous Commands
d git diff
ds git diff --stat (mnemonic: "diff stat")
hard git reset --hard
soft git reset --soft
scrap git checkout HEAD
CUSTOM ALIASES
Anything defined in the [alias] section of the repository, user, or system git config files are also available as top-level shell commands.
Assuming a ~/.gitconfig that looked like this:
[alias]
ci = commit --verbose
ca = commit -a
d = diff
s = status
thanks = !git-thanks
... you might then have the following shell session:
master!something> echo "stuff" >somefile
master!something*> s
M somefile
master!something*> d
diff --git a/somefile b/somefile
-- a/somefile
++ b/somefile
@@ -0,0 +1 @@
+ stuff
master!something*> ca -m "add stuff"
master!something> thanks HEAD
PROMPT
The default prompt shows the current branch, a bang (!), and then the relative path to the current working directory from the root of the
work tree. If the work tree includes modified files that have not yet been staged, a dirty status indicator (*) is also displayed.
The git-sh prompt includes ANSI colors when the git color.ui option is set and enabled. To enable git-sh's prompt colors explicitly, set
the color.sh config value to auto:
$ git config --global color.sh auto
Customize prompt colors by setting the color.sh.branch, color.sh.workdir, and color.sh.dirty git config values:
$ git config --global color.sh.branch 'yellow reverse'
$ git config --global color.sh.workdir 'blue bold'
$ git config --global color.sh.dirty 'red'
See colors in git for information.
COMPLETION
Bash completion support is automatically enabled for all git built-in commands and also for aliases defined in the user ~/.gitconfig file.
The auto-completion logic is smart enough to know an alias d that expands to git-diff should use the same completion configuration as the
git-diff command.
The completion code is a slightly modified version of the git bash completion script shipped with the core git distribution. The script is
built into thegit-sh executable at compile time and need not be obtained or installed separately.
CUSTOMIZING
Most git-sh behavior can be configured by editing the user or system gitconfig files (~/.gitconfig and /etc/gitconfig) either by hand or
using git-config(1). The [alias] section is used to create basic command aliases.
The /etc/gitshrc and ~/.gitshrc files are sourced (in that order) immediately before the shell becomes interactive.
The ~/.bashrc file is sourced before either /etc/gitshrc or ~/.gitshrc. Any bash customizations defined there and not explicitly overrid-
den by git-sh are also available.
ENVIRONMENT
PS1 Set to the dynamic git-sh prompt. This can be customized in the ~/.gitshrc or /etc/gitshrc files.
GIT_DIR
Explicitly set the path to the git repository instead of assuming the nearest .git path.
GIT_WORK_TREE
Explicitly set the path to the root of the work tree instead of assuming the nearest parent directory with a .git repository.
SEE ALSO bash(1), git(1), git-config(1),http://github.com/rtomayko/git-sh
Ryan Tomayko March 2010 GIT-SH(1)