Suppose that I have a variable $x, I want to test if the content of $x
match the pattern 'abc*'. If yes, then do something. (The operator ==
doesn't match patterns, if I understand it correctly.)
Is there such a build-in feature in bash? Or I have to rely on some
external program such as perl to t
Hi,
I'm wondering if there is a way that different bash processes share
the same stack. One way of doing so is to use a file to save the
stack. It is not difficult to implement this function myself, but I'm
just wondering if there is any simpler solution or anybody has done it
already. Thanks!
--
Hi,
I know that I should use =~ to match regex (bash version 4).
However, the man page is not very clear. I don't find how to match
(matching any single character). For example, the following regex
doesn't match txt. Does anybody know how to match any character
(should be '.' in perl) in bash
On Mon, Sep 26, 2011 at 9:49 PM, John Reiser wrote:
> Peng Yu wrote:
>> I know that I should use =~ to match regex (bash version 4).
>>
>> However, the man page is not very clear. I don't find how to match
>> (matching any single character). For example, the
On Tue, Sep 27, 2011 at 6:51 PM, Chet Ramey wrote:
> On 9/27/11 6:41 PM, Roger wrote:
>
>> Correct. After reading the entire Bash Manual page, I didn't see much
>> mention
>> of documentation resources (of ERE) besides maybe something about egrep from
>> Bash's Manual Page or elsewhere on the we
On Thu, Sep 29, 2011 at 7:22 AM, Greg Wooledge wrote:
> On Wed, Sep 28, 2011 at 12:43:01PM -0800, Roger wrote:
>> Seems I used 'man regex' as well here. AKA regex(3). But I did
>> realize this a few weeks ago; the real regex description being 'man 7 regex'.
>> The Bash Manual Page denotes only r
On Thu, Sep 29, 2011 at 10:38 AM, Chet Ramey wrote:
> On 9/29/11 9:48 AM, Peng Yu wrote:
>
>> Therefore, either bash manpage should specify clearly which regex
>> manpage it should be in each system (which a bad choice, because there
>> can be a large number of syste
On Thu, Sep 29, 2011 at 11:06 AM, Greg Wooledge wrote:
> On Thu, Sep 29, 2011 at 10:59:19AM -0500, Peng Yu wrote:
>> We all have discovered that regex(3) is not consistent across all the
>> platform. Why you say it is portable?
>
> The three systems I mentioned earlier t
Hi,
I want to use some alias in a bash script. But I have to include the
following line in the script in order to use the alias defined in
~/.bashrc. Is there a way to automatically load the alias from .bashrc
so that I don't have to explicitly include these two lines?
shopt -s expand_aliases
. ~
On Thu, Oct 27, 2011 at 11:43 AM, Greg Wooledge wrote:
> On Thu, Oct 27, 2011 at 04:39:23PM +, Stephane CHAZELAS wrote:
>> You mean you'd like every bash script you run on your system to
>> automatically source your ~/.bashrc.
>>
>> That sounds like a very unwise thing to do to me, but that
>
Hi,
Current, bash doesn't do command completion between do and done (for loop).
I'm wondering if this feature can be added.
--
Regards,
Peng
Hi,
Suppose that I have a verbatim string " a b c ( a'b | " in bash, and
I want to pass them as 6 command line arguments. I have to the
following conversion using quoteverb.sed to pass the 6 arguments
correctly to echo, which is a little bit cumbersome. I'm wondering if
there is any better way to
Hi Clark,
>> > v=" a b c ( a'b | "
>> > a=( $v )
>> > echo "${a[@]}"
>
> There's a @ char here.
I see. It's my mistake.
But I want to pass the 6 short arguments instead of 1 long argument to
echo. (echo is just an example, it can be any command that accepts
multiple arguments.)
~$ cat ./main1
Hi Clark,
> What do you mean by "1 long argument"?
>
> [bash-4.2.10] # cat foo.sh
> v=" a b c ( a'b | "
> set -o noglob
> a=( $v )
> set +o noglob
> for i in "${a[@]}"; do
> echo "$i"
> done
> [bash-4.2.10] # bash foo.sh
> a
> b
> c
> (
> a'b
> |
> [bash-4.2.10] #
I misunderstood the usage
On Mon, Nov 7, 2011 at 8:29 AM, Dennis Williamson
wrote:
> On Mon, Nov 7, 2011 at 7:23 AM, Peng Yu wrote:
>> Hi Clark,
>>
>>> What do you mean by "1 long argument"?
>>>
>>> [bash-4.2.10] # cat foo.sh
>>> v=" a b c ( a'b
Hi,
I need to use cron to run some job. I know that cron only set up very
basic environment. I'd like to duplicate my login environment. But
some environment variables are still not seen when I set the following
crontab entry. Does anybody know how to correctly set up the login
enviroment? (The ma
On Wed, Nov 9, 2011 at 7:45 AM, Greg Wooledge wrote:
> On Tue, Nov 08, 2011 at 09:46:37PM -0600, Peng Yu wrote:
>> I need to use cron to run some job. I know that cron only set up very
>> basic environment. I'd like to duplicate my login environment.
>
> Just so
On Wed, Nov 9, 2011 at 7:45 AM, Greg Wooledge wrote:
> On Tue, Nov 08, 2011 at 09:46:37PM -0600, Peng Yu wrote:
>> I need to use cron to run some job. I know that cron only set up very
>> basic environment. I'd like to duplicate my login environment.
>
> Just so
On Wed, Nov 9, 2011 at 10:41 AM, Greg Wooledge wrote:
> On Wed, Nov 09, 2011 at 10:29:52AM -0600, Peng Yu wrote:
>> I sourced my ~/.bashrc, which source some other files. It seems the
>> environment variables defined in these files are not seen with env.
>> Why is so?
>
&
Hi,
bash by default searchs in paths specified in the environment variable
PATH (separated by ":"). I'm not aware if there is any cache mechanism
to save the run time (but even so, different terminals still can not
see the same cache, hence each terminal has the overhead to create the
cache). When
Hi,
I know from the document that tilde expansion only works if the string
is unquoted (see below)
~$ cd '~/..'
-bash: cd: ~/..: No such file or directory
~$ cd ~/..
/Users$
I'm wondering if I already have a string variable, is there a bash
native to do tilde expansion on it.
var='~/..'
cd $var
Hi,
It is strange to me why complete doesn't print anything when it is
called in a bash script. I must have misunderstood some fundamentals.
Does anybody know why? Thanks!
~$ cat main.sh
#!/usr/bin/env bash
. ~/.bashrc
complete
~$ ./main.sh
~$ complete |head
complete -F _kill kill
complete -F
On Sat, Nov 12, 2011 at 10:01 AM, Andreas Schwab wrote:
> Peng Yu writes:
>
>> It is strange to me why complete doesn't print anything when it is
>> called in a bash script. I must have misunderstood some fundamentals.
>> Does anybody know why? Thanks!
>
>
On Sat, Nov 12, 2011 at 10:18 AM, Chet Ramey wrote:
> On 11/12/11 10:41 AM, Peng Yu wrote:
>> Hi,
>>
>> It is strange to me why complete doesn't print anything when it is
>> called in a bash script. I must have misunderstood some fundamentals.
>> Does anybod
Hi,
I find that I have to make a program quotearg.sh to convert an array
to a string by quoting each element. So that it be used for eval.
I'm not sure if there is a way that I can do eval in bash without
having to use quotearg.sh. If there is no such a way, should
quotearg.sh be added in bash (i
> Why not use the array instead of making it into a single string?
>
> $cmd "${args[@]}"
>
> Why are you using eval or quotearg.sh? It sounds as if you are
> making the process more complicated than it need be.
For the examples that I gave, probably it is not necessary.
I'm yet to make a co
> In any case, combining a command and its arguments in a single
> string is almost always the wrong way to go about it.
Please compare the two scripts and see if the second one makes more sense.
/tmp$ cat not_convert_args_to_string.sh
#!/bin/bash
options="$2"
find $1 $options
echo find $1
On Tue, Nov 15, 2011 at 6:43 PM, Chris F.A. Johnson
wrote:
> On Tue, 15 Nov 2011, Peng Yu wrote:
>
>>> In any case, combining a command and its arguments in a single
>>> string is almost always the wrong way to go about it.
>>
>> Please compare the t
> Then why don't you post that?
Please take a look and see if you have a better solution than the
following code without using quotearg.sh.
/tmp/tmp$ ll *
c d:
total 0
-rw-r--r-- 1 pengy wheel 0 2011-11-15 20:18:11 xx
a b:
total 0
-rw-r--r-- 1 pengy wheel 0 2011-11-15 20:18:15 yy
/tmp/tmp$ ../c
Hi Greg,
> **NEVER** use getopt(1). It is broken. It cannot be made to work
> correctly. Its entire design is flawed.
I don't see these warnings in my systems (macports and ubuntu) (This
is version of getopt on macports and ubuntu is free, I don't see there
is a reason that getopt can not be p
> And that is enough of this nonsense. I have cited three official manuals
> for you already. Let's move on.
I don't get it. Do you mean both traditional getopt and Debian getopt
are broken. To me it seems that Debian getopt is made to address the
short coming of transitional getopt. Yet you sti
> You may safely use getopts (the builtin). Never getopt.
If my understanding is correct, 'getopts' doesn't support the long
format. Hence, it does not satisfy my need and I shall not use it.
--
Regards,
Peng
Hi,
I don't see if there is a way to directly modify $@. I know 'shift'.
But I'm wondering if there is any other way to modify $@.
~$ 1=x
-bash: 1=x: command not found
~$ @=(a b c)
-bash: syntax error near unexpected token `a'
--
Regards,
Peng
Hi,
~$ cat ../execute.sh
#!/usr/bin/env bash
echo "$@"
"$@"
$ ../execute.sh ls >/tmp/tmp.txt
$ cat /tmp/tmp.txt #I don't want "ls" be in the file
ls
main.sh
'>' will not work unless eval is used in execute.sh.
$ ../execute.sh ls '>' /tmp/tmp.txt
ls > /tmp/tmp.txt
ls: cannot
> WHAT are you trying to DO?
I think that you might completely miss my point. I try to explain it
better. Let me know if this time it makes more sense to you.
I want to execute any command as if the 'execute.sh' does not present,
except that I want to print the command so that I know want the
com
> THAT will work. But why are you writing a script to read a shell command
> and then execute it? There is already a program that reads shell commands
This capability will be useful for debugging bash script.
For example, I have a set of commands in a bash script, each of them
output some thing
Hi,
I looks a little wired why 'until' is the way it is now. According to
the manual until is before the do-done block.
until test-commands; do consequent-commands; done
A common design of until in other language is that it allows the loop
body be executed at least once and test the condition at
Hi Greg,
> New users do not mess with programmable completion.
Given the context, I though that it was clear that "new users" means
users new to command completion. If it was not clear, I make it
explicit here.
--
Regards,
Peng
Hi,
As I mentioned previously, there are shortcomings in man bash. Here, I
just point another example. And I hope my suggestion will be
addressed.
As a reasonable search strategy to search for how to set $@ is to
search for '$@' in man bash. The literal word '$@' appears at the
following location
> Second, just search for the 'set' builtin, near the bottom of the man page.
Thank for clarifying the usage of set.
I looked closely to the document of set. I just find another problem,
it says the following. However, the description of -- way down below.
It should be the option be described. A
> +1 vote on getting the parameters listed with a leading dollar sign.
> The individual single character is difficult to search for but the
> combination of "$@" and so forth for the others is a useful search
> string. I have often wanted the manual to include the "$@"
> combination instead of jus
> There are shortcomings in _the man documentation format_ and one of them
> is that it doesn't work (at least for me...) when the documentation is
> longer than one screen or thereabouts. I've pretty much come to the
> conclusion that any man page that is over a couple of hundred lines is
> a wast
Hi,
I want to customize the command completion for completing executables,
I want to search in a file (which includes all the executables in
PATH) rather than the default PATH variable. But I don't see how to do
so, as the following help indicates that it can only configure how to
complete the arg
> empty lines. There is no programmable completion mechanism to complete
> on non-empty command names.
I'm wondering if it is worthwhile to add such a feature. I have run
into the problem that it is very slow to command complete an
incomplete command especially when other programs are accessing t
> Presumably you would also include aliases, shell builtins, and functions
> in this file.
Yes. I just want to replace executables in PATH by the result from my
custom function. I think that aliases, builtins, and functions are all
in the memory of bash already, so it doesn't take extra time to se
> I would envision that such a completion function would assemble its list
> of possible completions by using your read-from-a-file mechanism and
> augment the list using compgen -a/compgen -b/compgen -A function. It
> would probably also want to handle glob patterns and expand them to
> potential
> The bash man page already has ~70 pages manual. I don't like it to grow to
> ~700 pages (like the ABS Guide) with all the working examples you expected.
> :)
Do you use search at all? :) If you use search, it doesn't really
matter if is a 700 page manual.
--
Regards,
Peng
Hi,
I have vi mode set.
set -o vi.
Then I type v to enter the vi editor. In the vi editor, I type 'cd
/tmp'. Then, I get the following screen output. Notice that the prompt
does not change immediately after the cd command. Could anybody
reproduce this behavior? Thanks.
~$
cd /tmp
~$ echo $PWD
/
uot;-- -n".
-- -n~$
http://software.frodo.looijaard.name/getopt/
--
Regards,
Peng Yu, Ph.D.
Assistant Professor
Dept. Electrical and Computer Engineering & TEES-AgriLife Center for
Bioinformatics and Genomic Systems Engineering (CBGSE)
Texas A&M University
Office: 215F WEB
Phone: (97
If I have the following in the command line,
~/.bash
when I type , it will become /home/my_user_name/.bash
I'm wondering if it is possible to configure bash command completion,
so that it will still be '~/.bash'
On Mon, Nov 16, 2009 at 8:30 AM, Chet Ramey wrote:
>> If I have the following in the command line,
>>
>> ~/.bash
>>
>> when I type , it will become /home/my_user_name/.bash
>>
>> I'm wondering if it is possible to configure bash command completion,
>> so that it will still be '~/.bash'
>
> You don
On Mon, Nov 16, 2009 at 4:50 AM, Henning Garus
wrote:
> On Sun, Nov 15, 2009 at 08:31:38PM -0600, Peng Yu wrote:
>> If I have the following in the command line,
>>
>> ~/.bash
>>
>> when I type , it will become /home/my_user_name/.bash
>>
>> I
On Tue, Nov 17, 2009 at 1:15 PM, Chet Ramey wrote:
> Peng Yu wrote:
>> On Mon, Nov 16, 2009 at 8:30 AM, Chet Ramey wrote:
>>>> If I have the following in the command line,
>>>>
>>>> ~/.bash
>>>>
>>>> when I type , it will beco
I make my ~/.bash_profile empty. I still see
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
I checked /etc/profile and /etc/bash.bashrc. But I don't PATH is set
in the two files. I'm wondering from which file PATH is set. BTW, my
system is ubuntu.
On Tue, Nov 17, 2009 at 3:12 PM, Bob Proulx wrote:
> Peng Yu wrote:
>> I make my ~/.bash_profile empty. I still see
>>
>> $ echo $PATH
>> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
>
> What is in your ~/.bashrc file?
>
>> I
Suppose I have 'some.sh' in my command line, and my cursor is at '.'
$some.sh
Suppose there is only one command that start with 'some', which is
'something.sh'. After I type TAB, I will have 'something.sh.sh' in my
command line.
$something.sh.sh
I'm wondering if there is a way to configure bash
On Mon, Jan 18, 2010 at 10:00 AM, Chet Ramey wrote:
> On 1/18/10 9:49 AM, Peng Yu wrote:
>> Suppose I have 'some.sh' in my command line, and my cursor is at '.'
>>
>> $some.sh
>>
>> Suppose there is only one command that start with 'some
I got the following message. Is there a way to configure bash such
that there is not a limit like this?
/bin/bash: Argument list too long
I'm wondering if it is possible to color the files shown by command
completion (i.e. after typing ). The color scheme can be of the
same as the one used in "ls --color=auto". By this way, it is easier
to see what the type of the file is.
Suppose I file 'a1.txt' and 'a2.txt' in my current directory. When I
type 'cat a' then TAB, it will show me 'a1.txt' and 'a2.txt'. If I
type TAB repeatedly, it will always show me the same thing.
However, a better response might be
1. complete the command to 'cat a1.txt' at the 2nd TAB,
2. complet
On Thu, Feb 11, 2010 at 9:58 AM, Chet Ramey wrote:
> On 2/11/10 10:54 AM, Peng Yu wrote:
>> Suppose I file 'a1.txt' and 'a2.txt' in my current directory. When I
>> type 'cat a' then TAB, it will show me 'a1.txt' and 'a2.txt'. I
On Thu, Feb 11, 2010 at 10:36 AM, Chet Ramey wrote:
> On 2/11/10 11:05 AM, Peng Yu wrote:
>> On Thu, Feb 11, 2010 at 9:58 AM, Chet Ramey wrote:
>>> On 2/11/10 10:54 AM, Peng Yu wrote:
>>>> Suppose I file 'a1.txt' and 'a2.txt' in my current dir
On Fri, Feb 12, 2010 at 1:36 PM, DennisW wrote:
> On Feb 11, 11:33 am, Peng Yu wrote:
>> On Thu, Feb 11, 2010 at 10:36 AM, Chet Ramey wrote:
>> > On 2/11/10 11:05 AM, Peng Yu wrote:
>> >> On Thu, Feb 11, 2010 at 9:58 AM, Chet Ramey wrote:
>> &g
$0 gives the file name of the script. I could use several shell
command to get the directory where the script is in. But I'm wondering
if there is an easy-to-use variable that refers to the directory where
the script is in?
On Fri, Feb 12, 2010 at 10:43 AM, Chet Ramey wrote:
> On 2/11/10 6:14 PM, Peng Yu wrote:
>
>> bind 'set show-all-if-ambiguous On'
>> bind 'TAB:menu-complete'
>>
>> I typed the above commands in the command line, but I still don't see
>&g
My grep is aliased to "grep --color=auto".
I then use grep "", where is a tab character. But the
result is not colored. How to make the tabs colored?
I make the following directory and try to cd to it. But I can't. Could
you let me know what is the correct way of doing so?
$ mkdir environment\<\-
$ cd environmen\<\-
-bash: cd: environmen<-: No such file or directory
--
Regards,
Peng
On Thu, Apr 8, 2010 at 4:58 PM, Peng Yu wrote:
> I make the following directory and try to cd to it. But I can't. Could
> you let me know what is the correct way of doing so?
>
> $ mkdir environment\<\-
> $ cd environmen\<\-
> -bash: cd: environmen<-: No such file
I'm wondering how to start bash without inheriting any environment
variables and user level profiles (such as .bash_profile). Would you
please let me know what option to use?
--
Regards,
Peng
Hi,
I want $page has three digits. If it is less than 100, prefix it with
0. Is there an easy way to do so in bash?
for i in `seq 28 55`;
do
page=`echo '148-('$i'-28)*2'|bc`
echo $i $page
done
--
Regards,
Peng
rnal calls to bc and seq in addition to zero-padding
> $page.
It is good to know this trick.
> On Tue, May 4, 2010 at 8:05 AM, Peng Yu wrote:
>> Hi,
>>
>> I want $page has three digits. If it is less than 100, prefix it with
>> 0. Is there an easy way to do so in b
Suppose that I have a symbolic link link1 pointing to file1. When I
write to link1, I don't want file1 change. I want it to remove the
link generated a new file and write to it.
pipe '>' will change file 1. I'm wondering if there is way to do so,
so that I don't have to test whether it is a symbol
On Thu, May 6, 2010 at 10:53 AM, Pierre Gaston wrote:
> On Thu, May 6, 2010 at 5:53 PM, Peng Yu wrote:
>> Suppose that I have a symbolic link link1 pointing to file1. When I
>> write to link1, I don't want file1 change. I want it to remove the
>> link generated
On Thu, May 6, 2010 at 5:36 PM, Bob Proulx wrote:
> Peng Yu wrote:
>> Is there a way to overload operators like '>' and '>>' in bash, just
>> as overloading in C++, etc. Suppose I have already made some bash
>> program using '>' and
On Fri, May 7, 2010 at 9:26 AM, Marc Herbert wrote:
> Le 06/05/2010 15:53, Peng Yu a écrit :
>> Suppose that I have a symbolic link link1 pointing to file1. When I
>> write to link1, I don't want file1 change. I want it to remove the
>> link generated a new file and
On Fri, May 7, 2010 at 10:16 AM, Eric Blake wrote:
> On 05/07/2010 09:02 AM, Peng Yu wrote:
>> Suppose I need to modify one primary file slightly to do something a
>> little bit different. But I still need to do the original job,
>> therefore I need to keep it the original M
On Fri, May 7, 2010 at 10:41 AM, Eric Blake wrote:
> On 05/07/2010 09:31 AM, Peng Yu wrote:
>> On Fri, May 7, 2010 at 10:16 AM, Eric Blake wrote:
>>> On 05/07/2010 09:02 AM, Peng Yu wrote:
>>>> Suppose I need to modify one primary file slightly to do something a
&g
On Mon, May 10, 2010 at 6:59 AM, Marc Herbert wrote:
> Le 07/05/2010 16:02, Peng Yu a écrit :
>> I can copy the whole
>> directory and then modify one file in the newly copied N files. But
>> I'll lose track of which file has been changed later on, which is
>> i
x=10
for i in {1..$x}; do echo $i; done
The above code give me
{1..10}
, rather than printing numbers from 1 to 10.
I'm wondering how to use variable in a range?
--
Regards,
Peng
I tried the following command to create a dir with '/' in the name.
But it only create a directory with name 'm'. Is there a way to make a
directory with '/' in the name?
mkdir m\/\/
--
Regards,
Peng
When I type something after 'which', something means a command.
However, bash doesn't do command completion for the argument after
'which'. Is there a way to configure bash behave depending on the
context (in this case, do autocomplete after 'which')?
--
Regards,
Peng
On Fri, May 21, 2010 at 10:39 AM, Chet Ramey wrote:
> On 5/21/10 11:25 AM, Peng Yu wrote:
>> When I type something after 'which', something means a command.
>> However, bash doesn't do command completion for the argument after
>> 'which'. Is there a
On Fri, May 21, 2010 at 11:19 AM, Marc Herbert wrote:
> Le 21/05/2010 16:25, Peng Yu a écrit :
>> When I type something after 'which', something means a command.
>> However, bash doesn't do command completion for the argument after
>> 'which'. Is the
On Fri, May 21, 2010 at 11:06 AM, Eric Blake wrote:
> On 05/21/2010 09:50 AM, Peng Yu wrote:
>> complete -c works. I'm not familar with bash-completion package. How
>> to customize search path for each command.
>
> By using appropriate complete invocations for each co
On Fri, May 21, 2010 at 12:07 PM, Eric Blake wrote:
> On 05/21/2010 10:41 AM, Peng Yu wrote:
>>> 'help complete' is the easiest way to see the short details; other than
>>> that, look for complete under 'SHELL BUILTIN COMMANDS' in the man page.
>>
&
> You will need to source the file that contains the functions:
>
> source /etc/bash_completions
>
> The installation you did most likely added something like this to your
> ~/.bashrc:
>
> # enable programmable completion features (you don't need to enable
> # this, if it's already enabled in /etc/
ls -go gives me permission and file sizes. But I only want to show
time and file names. Would you please let me know what command to use?
--
Regards,
Peng
When I type 'cd $HOME/.', bash will expand the command to 'cd
/home/my_user_name/.'. Would you please let me know how to let bash
expand the environment variable?
--
Regards,
Peng
On Sat, May 22, 2010 at 3:48 PM, Peng Yu wrote:
> When I type 'cd $HOME/.', bash will expand the command to 'cd
> /home/my_user_name/.'. Would you please let me know how to let bash
> expand the environment variable?
I mean 'NOT to let bash ...'. A
> I also tried 'python $SOME_VARIABLE/', where $SOME_VARIABLE is
> set to a directory. Wired enough, this time $SOME_VARIABLE is not
> expanded at all, neither any completion to any files under the
> directory $SOME_VARIABLE.
I was confused. The above statement is not true.
--
Regards,
Peng
On Tue, May 25, 2010 at 9:18 PM, Chet Ramey wrote:
>> When I type 'cd $HOME/.', bash will expand the command to 'cd
>> /home/my_user_name/.'. Would you please let me know how to let bash
>> expand the environment variable?
>
> There is no setting to suppress the environment variable expansion. Ba
I have a program that only accept argument with a give suffix
./program xxx.suffix
If I use process substitution, which gives me /dev/fd/xx, it will not
work with the program. Is there a way to make sure a suffix is added
to the substitute process file handle in /def/fd/, so that the program
can
Hello,
I frequently need do cd multiple levels up. For example,
cd ../..
cd ../../../../
It would be convenient to type something like "cd 2" or "cd 4". Is
there a command for this?
--
Regards,
Peng
Hi,
I only want to convert symbolic links that point outside the directory
to be archived to a file. But I still want to keep symbolic links
point inside as symbolic links. Is there an option or a walkaround to
do so in tar?
--
Regards,
Peng
I use bash --noprofile to start a bash session. Since this doesn't
source any profile files, I'd think that no environment variable
should be set. But I still see environment variables set. Are they
inherit from the parent session. Is there a way to start a bash
session without using parent environ
The commented line in the following bash script is not working. I
notice the following description from man bash and I think that it is
the reason. But I'm not completely sure. Would you please confirm it
for me?
Also, I'm wondering where this decision was made. Can't bash be made
more powerful by
Hi,
According to man bash, I thought that $@ instead of $* can help me
pass a string with space as a parameter. But it is not. Would you
please show me how to print 'b c' as a single argument in the
following code?
#!/usr/bin/env bash
function f {
#for i in $*;
for i in $@;
do
echo $i
done
}
On Wed, Jun 23, 2010 at 5:43 PM, Chris F.A. Johnson
wrote:
> On Wed, 23 Jun 2010, Peng Yu wrote:
>
>> Hi,
>>
>> According to man bash, I thought that $@ instead of $* can help me
>> pass a string with space as a parameter. But it is not. Would you
>> please sh
Hi,
array=(a b c)
echo ${arr...@]:1:2}
I'm looking for the document for the above usage. I checked the Arrays
section of man bash, but I don't see a description of such usage. I
also searched man bash with [0-9]+:[0-9]+. But I still don't find a
description. Could anybody let me know where this
sub\u2010
.
On Thu, Jul 8, 2010 at 9:27 PM, Peng Yu wrote:
> Hi,
>
> array=(a b c)
> echo ${arr...@]:1:2}
>
>
> I'm looking for the document for the above usage. I checked the Arrays
> section of man bash, but I don't see a description of such usage. I
> a
1 - 100 of 177 matches
Mail list logo