To create an alias for grep and to exclude svn directory
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
To create an alias for grep and to exclude svn directory (currently no questions cover this) on bash env I did:
$ function gp grep -rnIi --exclude-dir='.svn';
However,
I get error
bash: syntax error near unexpected token `}'
How do I go about this?
bash alias bashrc subversion
up vote
0
down vote
favorite
To create an alias for grep and to exclude svn directory (currently no questions cover this) on bash env I did:
$ function gp grep -rnIi --exclude-dir='.svn';
However,
I get error
bash: syntax error near unexpected token `'
How do I go about this?
bash alias bashrc subversion
Kusalananda showed you how to define agp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is thatmust be followed by a space (or a newline).
â Scott
Sep 10 at 21:04
Thanks Scott and Kusalananda. I changed my code to and it works: function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
â piyush89
Sep 11 at 17:17
add a comment '
How do I go about this?
bash alias bashrc subversion
To create an alias for grep and to exclude svn directory (currently no questions cover this) on bash env I did:
$ function gp grep -rnIi --exclude-dir='.svn';
However,
I get error
bash: syntax error near unexpected token `}'
How do I go about this?
bash alias bashrc subversion
bash alias bashrc subversion
edited Sep 10 at 20:35
RalfFriedl
4,1251625
4,1251625
asked Sep 10 at 19:48
piyush89
1
1
Kusalananda showed you how to define agp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is that{
must be followed by a space (or a newline).
â Scott
Sep 10 at 21:04
Thanks Scott and Kusalananda. I changed my code to and it works: function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
â piyush89
Sep 11 at 17:17
add a comment |Â
Kusalananda showed you how to define agp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is that{
must be followed by a space (or a newline).
â Scott
Sep 10 at 21:04
Thanks Scott and Kusalananda. I changed my code to and it works: function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
â piyush89
Sep 11 at 17:17
Kusalananda showed you how to define a
gp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is that {
must be followed by a space (or a newline).â Scott
Sep 10 at 21:04
Kusalananda showed you how to define a
gp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is that {
must be followed by a space (or a newline).â Scott
Sep 10 at 21:04
Thanks Scott and Kusalananda. I changed my code to and it works: function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
â piyush89
Sep 11 at 17:17
Thanks Scott and Kusalananda. I changed my code to and it works: function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
â piyush89
Sep 11 at 17:17
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
function is not alias
alias gp="grep -rnIi --exclude-dir='.svn'"
1
As a function:gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
add a comment |Â
up vote
-1
down vote
I changed my code to:
function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
and it works
ItâÂÂs better to use"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e.,$1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.
â Scott
Sep 11 at 20:07
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
function is not alias
alias gp="grep -rnIi --exclude-dir='.svn'"
1
As a function:gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
add a comment |Â
up vote
0
down vote
function is not alias
alias gp="grep -rnIi --exclude-dir='.svn'"
1
As a function:gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
add a comment |Â
up vote
0
down vote
up vote
0
down vote
function is not alias
alias gp="grep -rnIi --exclude-dir='.svn'"
function is not alias
alias gp="grep -rnIi --exclude-dir='.svn'"
answered Sep 10 at 19:51
Ipor Sircer
9,3481920
9,3481920
1
As a function:gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
add a comment |Â
1
As a function:gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
1
1
As a function:
gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
As a function:
gp () grep ... "$@";
â Kusalananda
Sep 10 at 20:02
add a comment |Â
up vote
-1
down vote
I changed my code to:
function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
and it works
ItâÂÂs better to use"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e.,$1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.
â Scott
Sep 11 at 20:07
add a comment |Â
up vote
-1
down vote
I changed my code to:
function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
and it works
ItâÂÂs better to use"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e.,$1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.
â Scott
Sep 11 at 20:07
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
I changed my code to:
function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
and it works
I changed my code to:
function gp() grep -rnIi --exclude-dir='.svn' $1 $2;
and it works
edited Sep 11 at 20:07
Scott
6,35642450
6,35642450
answered Sep 11 at 17:19
piyush89
1
1
ItâÂÂs better to use"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e.,$1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.
â Scott
Sep 11 at 20:07
add a comment |Â
ItâÂÂs better to use"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e.,$1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.
â Scott
Sep 11 at 20:07
ItâÂÂs better to use
"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e., $1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.â Scott
Sep 11 at 20:07
ItâÂÂs better to use
"$@"
, as Kusalananda suggested.âÂÂIt automatically expands to all the arguments that are passed to the function (i.e., $1â¯$2â¯$3â¯$4â¯â¦
), so you can run it on many filesâÂÂ/âÂÂdirectories at once, and it quotes them, so your pattern and filenames can have spaces and special characters.â Scott
Sep 11 at 20:07
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468098%2fto-create-an-alias-for-grep-and-to-exclude-svn-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Kusalananda showed you how to define a
gp
function, but he didnâÂÂt explicitly identify the error in your attempt, which is thatÂ