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
I been trying to add a option to my bash shell script that is someone does a "-r" I do a push to a git server but I am getting the following error
mirror.sh: line 8: conditional binary operator expected
mirror.sh: line 8: syntax error near `-e'
mirror.sh: line 8: `if [[ "$1" -e "-r" ]];then'
below is my bash script:
#!/bin/bash
cd /home/joe/Documents/sourcecode/mirror.git
git svn rebase
#
# i
I am currently trying to write a bash script which helps me step through a directory and check for .jpeg or .jpg extensions on files.
When I log in, appears the following error:
-bash: /etc/profile: line 1: syntax error near unexpected token ('
Inside the file there is the next code:
n# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))\n
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).\n\nif
[ -d /etc/profile.d ]; then\nfor i in /etc/profile.d/*.sh; do\nif [ -r $i ];
then\n.
I want to push the bash history to my github account regularly,say everyday I will push the history to github, how do I do it. Any heads up. Is it possbile?
The bash history file should be renamed to the current data-time. So that I can track. In spite of having a local bash history I prefer to have in github also.
Thanks a lot
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' ' ` ]; then echo "NUM is OK "; fi done'
How may I know if a script is either written in bash or sh?
The first line of the script mean nothing, since on Linux, bash script has this line:
#!bin/sh
Actually, there are many distribution where bin/sh is bash (maybe a bin/sh is a link to bin/bash in those distro), and not bourn shell.
I have a .bashrc file that has a very simple function like this
function module() {
....
}
I type "bash" on the command prompt and as expected the .bashrc gets executed however I get the error:
'ash: /user/.bashrc: line 1: syntax error near unexpected token `{
'ash: /user/.bashrc: line 1: `function module() {
I have tried removing the word "function" and I have also tried removing the ()
How can I find out whether a script is written in bash or sh?
The first line of the script is not helpful here, since on Linux, bash scripts have this line:
#!bin/sh
Actually, there are many distribution where bin/sh is bash (maybe bin/sh is a link to bin/bash in those distributions), and not Bourne Shell.