Search:

Type: Posts; User: geirha; Keyword(s):

Page 1 of 10 1 2 3 4

Search: Search took 0.20 seconds.

  1. Re: bash: execute in background and wait for a string at stdout?

    Heh, you revived a 3.5 year old thread.

    Anyway, everything in that script will work with bourne, except the process substitution. You can use a fifo instead.



    #!/bin/sh

    somecommand() {
    ...
  2. Re: running shell scripts in different directories

    I prefer to just do the cd in a subshell.


    for dir in ./*/; do
    ( cd "$dir" && ./script.sh )
    done


    Is script.sh the same script copied to each directory?
  3. Replies
    12
    Views
    714

    Re: help writing simple renaming script.

    Bash will expand parameter expansions inside double quotes, so it replaces $1 and $2 with the first two arguments of your shell (which are typically empty in an interactive shell). With single quotes...
  4. Replies
    6
    Views
    327

    Re: bash variables line by lone from file

    A couple of example lines from the users_data_file.txt file would help.
  5. Replies
    2
    Views
    487

    Re: Basic journal script with bash

    Bash already logs your commands for you to ~/.bash_history. By default it doesn't add a timestamp, but you can modify the special HISTTIMEFORMAT variable to achieve that.

    E.g. add the following...
  6. Replies
    4
    Views
    298

    Re: [BASH] File Editing

    It sounds like this could be related to this question in the BashFAQ,
    How can I get all lines that are: in both of two files (set intersection) or in only one of two files (set subtraction), so I'll...
  7. Replies
    9
    Views
    2,982

    [SOLVED] Re: Help with a sed expression?

    You can match start of word and end of word with \< and \>. (A word in this context consists of [A-Za-z0-9_])


    $ sed 's/\<usr\>/NEW/g' <<< "%usr% 4usr4 .usr."
    %NEW% 4usr4 .NEW.


    This syntax...
  8. Replies
    1
    Views
    608

    [ubuntu] Re: svn: Unrecognized URL scheme

    Check the contents of that /home/devserve/usvn-1.0/files/svn/testproject/hooks/post-commit script. My guess is it uses the absolute path to svn instead of relying on the PATH variable.
  9. Replies
    16
    Views
    1,608

    [SOLVED] Re: Bash add 2 digit Numbers

    Are you running that on Ubuntu? There are several different rename commands, using completely different syntaxes. The default rename command in Ubuntu is perl rename, with which stylishpants' rename...
  10. Replies
    5
    Views
    250

    [SOLVED] Re: Why is this script working? [BASH]

    Aha, in that case this thread's title is misleading. Based on the title on that book, it most likely teaches you to write sh scripts, not bash scripts.
  11. Replies
    5
    Views
    250

    [SOLVED] Re: Why is this script working? [BASH]

    When you omit the in words part, it assumes in "$@". Run help for in an interactive bash shell to see the syntax.

    Out of curiosity, which book is it?
  12. Replies
    16
    Views
    1,608

    [SOLVED] Re: Bash add 2 digit Numbers

    find . -type f -name "Track [0-9].mp3" -exec sh -c 'for file; do mv "$file" "${file%[0-9].mp3}0${file##* }"; done' _ {} +

    See http://mywiki.wooledge.org/BashFAQ/030 for other approaches.
  13. Replies
    15
    Views
    1,257

    Re: bash logging pipe in

    Here's your logger command written in bash:


    logger() {
    local prevline line count

    while IFS= read -r line; do
    if [[ $line = "$prevline" ]]; then
    ((count++))
    ...
  14. Replies
    15
    Views
    1,257

    Re: bash logging pipe in

    program 2>&1 | logger

    You might want some options for the logger command. See man logger.
  15. Replies
    2
    Views
    598

    [SOLVED] Re: How to increment a column in AWK

    Use a for-loop in the BEGIN block.

    awk '
    BEGIN {
    for (t=0;t<100;t++) {
    print t, 15.3*...;
    }
    }'
  16. Replies
    8
    Views
    563

    Re: echo | nc does not work on desktop

    Ah, right, because 8.04 and 10.04 has different implementations of nc installed by default, and since there is no standard determining the behavior of nc, we happen to have two versions of nc...
  17. [SOLVED] Re: Bash: Why are these two variables treated differently?

    Right, then var=$(<"$filename") will do, though since it's just one line, you can also use read. Using read is more efficient, and I also find that "prettier".

    read -r var < "$filename"
  18. Replies
    8
    Views
    563

    Re: echo | nc does not work on desktop

    My best guess is that you run that script with sh instead of bash. Bash's echo takes -e and -n as options, sh's echo does not. Use printf instead or at least make sure you run the script with bash.
    ...
  19. Re: how to check a directory's permissions in a bash script???

    If you want all files to have the same mode, just run the chmod uncoditionally on all files. If the file already has that mode, nothing happens, if it has a different mode, it gets the new mode.
    ...
  20. [SOLVED] Re: Bash: Why are these two variables treated differently?

    You can't export array variables. I'm not exactly sure how bash handles export var=( something ), but it's pointless anyway, so don't do it. What are you actually trying to do?

    For reading the...
  21. Replies
    4
    Views
    431

    [SOLVED] Re: I need help with pv cursor control

    pv -fr < A.mkv 2> >(tr '\r' '\n' > foo.txt) | mplayer -msglevel all=1 -

    Since pv's output isn't going to a terminal, it'll buffer it though, so you likely won't see any data in foo.txt until it's...
  22. Replies
    10
    Views
    437

    Re: [Qeustion] about Shellscript ubuntu

    Well, problem is, "give int passwd user" doesn't make any sense, what do you mean? And what do you mean by "Shadow user" and "Group user"?

    If you have some sample input and wanted output you...
  23. Replies
    10
    Views
    437

    Re: [Qeustion] about Shellscript ubuntu

    Your question is not understandable, not to me at least. You'll have to write it in valid english. Perhaps see if there's a Loco team for your language and ask your question there.
    ...
  24. Replies
    10
    Views
    437

    Re: [Qeustion] about Shellscript ubuntu

    For adding many users in batch, look into newusers(8).

    man 8 newusers
  25. Replies
    7
    Views
    2,674

    Re: : bad substitution, bash script

    Ah, the closing ;; was missing. I completely missed that.

    Though, the TLDP bash guides are outdated and littered with bad practice as usual. Parsing df -h output, piping together awk and grep,...
Results 1 to 25 of 250
Page 1 of 10 1 2 3 4