I want to run this bash command :
#!/bin/bash
rep="*"
for f in `ls -R`$rep; do
d='git log '$f'| wc -l'
c=$d
echo $c
done
how to excute a command git log myFile | wc -l from bash ?
ps : this command will return a number : git log myFile | wc -l
when I run from bash shell the command:
bash
for i in 1 2 3 ; do echo $i ; done
1
2
3
but when I switch to tcsh and want to run:
tcsh
bash -c for i in 1 2 3 ; do echo $i ; done
i: -c: line 1: syntax error near unexpected token `newline'
i: -c: line 1: `for'
i: Undefined variable.
please advice why I get errors ( I run the for loop from bash -c its the same ?
and what I ne
Sometimes is useful to run over and over again the same command until something happen, for example you could do a ls -lrt until a file has reached a certain dimension or is created, how to do it ?
I have modified the .bashrc.
I would like to remove carriage returns/line feeds in a text file, but in a specific cadence:
Read first line (Header Line 1), remove cr/lf at the end (replace it with a space ideally);
Read the next line (Line of Text 2), leave the cr/lf intact;
Read the next line, remove the cr/lf;
Read the next line (Header Line 2), remove cr/lf at the end (replace it with a space);
Read the next line (Line of
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
sh
I want to run this bash command :
#!/bin/bash
rep="*"
for f in `ls -R`$rep; do
d='git log '$f'| wc -l'
c=$d
echo $c
done
how to excute a command git log myFile | wc -l from bash ?
ps : this command will return a number : git log myFile | wc -l
I have a "command" text file that issues a data file download command on each
line. I send the command file to bash. However, a small percentage of the downloads fail.
I write the line below in order to verify if first or second fields of list of numbers are equal to 146
I want to run the line from tcsh shell with one line as bash shell
please advice what the problem here in the syntax ?
echo $numbers
146 146 0 16 16 10 42 12 10 32 32 3 2 32 26
tcsh
bash -c 'for i in 1 2; do if [ 146 = `echo $numbers | cut -f$i -d' '