[SOLVED] alias or bash question

Hello all,
I just need a liittle help on alias or bash
Right now, I want to run vim on xterm. So I always invoke
xterm vim
Everything works fine but when I manually add a directory or a directory of a file, something like
xterm vim /directory/of/file_here
It won't work.
This is like manually opening a file in gvim or any app.
I just want vim to run on xterm.  This is like clicking a file and open with gvim ('xterm vim' in this case).
I'm currently using KDEmod4.2
Last edited by ragingmon (2009-02-22 11:08:21)

yay!! thanks a lot droog!!!
that was really fast.
marked as solved..

Similar Messages

  • [SOLVED] Stupid bash question (cp command)

    I accidentally copied a file using * as the destination, like this:
    cp /path/to/file *
    There was no error so it must have done something but I can't figure out what.
    Can anyone tell me what that command does, thanks.
    Last edited by r6 (2010-08-31 07:15:29)

    Hehe getting used to the terminal in the beginning can be fun, you are bound to make some mistakes - I still do at times
    In the mean time adding these to your .bashrc could be helpful safer:
    alias mv="mv -i"
    alias cp="cp -i"
    alias rm="rm -i"

  • [Solved] Quick Bash Question

    Ok, I have a loop and I want to count the number of times the loop occurs in my script. Every time the loop occurs there is an output. I want during the loop to display 1 - infinite number until the loop stops.
    Do you know what I am getting at?
    Last edited by haxit (2009-02-13 18:04:37)

    Ok, so I have this script:
    #!/bin/bash
    if [ -z "$1" ]; then
    echo "Please run like so: 'sh "$0" <highest number on dice>'"
    else
    WOW=`echo "$1*2" | bc`
    for X in 1 2 3; do
    ONE=`seq 1 $1 | sort -R | head -1`
    TWO=`seq 1 $1 | sort -R | head -1`
    HAH=`echo "$ONE+$TWO" | bc`
    until [ $HAH -eq $WOW ]; do
    ONE=`seq 1 $1 | sort -R | head -1`
    TWO=`seq 1 $1 | sort -R | head -1`
    HAH=`echo "$ONE+$TWO" | bc`
    NUM=`echo "1"`
    echo "$HAH" >> probability.log
    done
    LOL=`cat probability.log | wc -l`
    echo "$LOL"
    rm probability.log
    done
    fi
    It gives me three outputs, I want to add those outputs and divide them by 3.

  • [SOLVED] Quick bash question (~/.bashrc stuff)

    Hi!
    First I have to say that I have installed Arch few days ago and it's pretty sweet stuff -- but I guess you already have heard that oh-so-many-times!
    So there is it, I would like to change my prompt's color everytime <enter> is pressed in the terminal (well, everytime a new prompt is shown).
    But so far I was only able to change my prompt's color everytime a new terminal is opened, with this code in .bashrc :
    # color changing for the prompt
    colors=("\[\e[0;30m\]" "\[\e[0;34m\]" "\[\e[0;32m\]" "\[\e[0;36m\]" "\[\e[0;31m\]" "\[\e[0;35m\]" "\[\e[0;33m\]" "\[\e[0;37m\]" "\[\e[1;30m\]" "\[\e[1;34m\]" "\[\e[1;32m\]" "\[\e[1;36m\]" "\[\e[1;31m\]" "\[\e[1;35m\]" "\[\e[1;32m\]" "\[\e[1;37m\]")
    let R=$RANDOM%16+0
    color=${colors[$R]}
    prompt="${color}\u@\h:\w\$\[\e[0m\] "
    # the prompt
    PS1=$prompt
    Thanks.
    Last edited by orph (2009-03-01 16:10:57)

    You could use the PROMPT_COMMAND:
    colors=("\[\e[0;30m\]" "\[\e[0;34m\]" "\[\e[0;32m\]" "\[\e[0;36m\]" "\[\e[0;31m\]" "\[\e[0;35m\]" "\[\e[0;33m\]" "\[\e[0;37m\]" "\[\e[1;30m\]" "\[\e[1;34m\]" "\[\e[1;32m\]" "\[\e[1;36m\]" "\[\e[1;31m\]" "\[\e[1;35m\]" "\[\e[1;32m\]" "\[\e[1;37m\]")
    PROMPT_COMMAND='let R=$RANDOM%16+0;color=${colors[$R]};PS1="${color}\u@\h:\w\$\[\e[0m\] "'

  • [SOLVED] alias with sudo: Password request malfunction

    Okay so here are two cool little system-maintenance related aliases, as suggested by "pacman tips" Wiki:
    Show dirs not owned by any package:
    alias pacman-disowned-dirs="comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type d -print | sed 's/\([^/]\)$/\1\//' | sort -u) <(pacman -Qlq | sort -u)"
    Show files not owned by any package:
    alias pacman-disowned-files="comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type f -print | sort -u) <(pacman -Qlq | sort -u)"
    typically I edit those into my "/etc/bash.bashrc" instead of "~/.bashrc", but there's no difference there. The thing is, when I invoke this alias,
    as regular user, it promptly requests [sudo] password, as it should, but after a brief moment the console returns to normal, there's no time for to even input the password, like this:
    [danilo@dandelion ~]$ pacman-disowned-dirs
    [sudo] password for danilo:
    [danilo@dandelion ~]$
    PS: If my password is still cached, it will work normally (my timeout is set to 30 min).
    here's my "/etc/bash.bashrc" at any rate:
    # /etc/bash.bashrc
    ## If not running interactively, don't do anything ##
    # [[ $- != *i* ]] && return
    ## Prompt display configurations ##
    set_prompt () {
    local last_command=$? # Must come first!
    PS1='\[\e[1;33m\]'
    if [[ $last_command != 0 ]]; then
    PS1+='$?'
    fi
    if [[ $EUID == 0 ]]; then
    PS1+='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
    else
    PS1+='\[\e[1;34m\][\u@\h \W]\$\[\e[0m\] '
    fi
    PROMPT_COMMAND='set_prompt'
    PS2='> '
    PS3='> '
    PS4='+ '
    ## Original default configs ##
    case ${TERM} in
    xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
    screen)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
    esac
    ## File sourcing ##
    [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
    ## Functions ## {{{
    ## Aliases ## {{{
    # Privileged access #
    if [ $UID -ne 0 ]; then
    alias sudo='sudo '
    alias scat='sudo cat'
    alias svim='sudoedit'
    alias root='sudo -i'
    alias reboot='sudo systemctl reboot'
    alias poweroff='sudo systemctl poweroff'
    alias update='sudo pacman -Su'
    alias netctl='sudo netctl'
    fi
    # listing #
    alias ls='ls -hF --color=auto'
    alias lr='ls -R' # recursive ls
    alias ll='ls -l'
    alias lall='ls -la'
    alias la='ll -A'
    alias lx='ll -BX' # sort by extension
    alias lz='ll -rS' # sort by size
    alias lt='ll -rt' # sort by date
    alias lm='la | more'
    # Show dirs that do not belong to any package #
    alias pacman-disowned-dirs="comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type d -print | sed 's/\([^/]\)$/\1\//' | sort -u) <(pacman -Qlq | sort -u)"
    # Show files that do not belong to any package #
    alias pacman-disowned-files="comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type f -print | sort -u) && <(pacman -Qlq | sort -u)"
    Last edited by DVNO (2014-08-12 05:12:57)

    You'd suppose it would work, but no, same error... Perhaps it traces back to some other configuration file...
    By the way, the second command, I didn't paste it correctly; There's no "&&" before the pacman query part of the command. Fixing the post now...
    Well, anyways, I believe I got'em working, I appended a useless command that requires elevation AND works properly, like this:
    alias pacman-disowned-dirs="sudo true && comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type d -print | sed 's/\([^/]\)$/\1\//' | sort -u) <(pacman -Qlq | sort -u)"
    And:
    alias pacman-disowned-files="sudo true && comm -23 <(sudo find / \( -path '/dev' -o -path '/sys' -o -path '/run' -o -path '/tmp' -o -path '/mnt' -o -path '/srv' -o -path '/proc' -o -path '/boot' -o -path '/home' -o -path '/root' -o -path '/media' -o -path '/var/lib/pacman' -o -path '/var/cache/pacman' \) -prune -o -type f -print | sort -u) <(pacman -Qlq | sort -u)"
    ...Still, it's a r@t workaround, not a proper solution, so I'll ask to not mark this as solved yet. Maybe someone can backtrack this properly.
    Thank you, for the quick reply, much appreciated.

  • [SOLVED]Slim and gdm questions

    Hi all,
    I just installed slim cause I wanted to try something new and faster than gdm login manager for gnome, I have it working right now but with a few hiccups:
    1- I login using slim, but after I am logged in the system if I lock the screen, the gdm login shows (instead of the slim one)
    2- System bootup is a LOT slower, after I login the system stays with just the background for a few seconds, then loads the desktop.
    So, here are my questions:
    a) If I remove gdm will I have this same issues? maybe the increased boot time is because I have 2 login managers installed?
    b) I disabled the gdm daemon from rc.conf (put a ! before it), should I remove it from there completely? because apparently it is still loading.
    Also I dont know much about login managers so I wanted a little enlightenment in this matter.
    regards and thanks in advance
    Last edited by 655321 (2010-06-13 20:57:35)

    BKLive
    Here is the info:
    slim.conf
    # Path, X server and arguments (if needed)
    # Note: -xauth $authfile is automatically appended
    default_path        ./:/bin:/usr/bin:/usr/local/bin
    default_xserver     /usr/bin/X
    xserver_arguments   -nolisten tcp vt07
    # Commands for halt, login, etc.
    halt_cmd            /sbin/shutdown -h now
    reboot_cmd          /sbin/shutdown -r now
    console_cmd         /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
    #suspend_cmd        /usr/sbin/suspend
    # Full path to the xauth binary
    xauth_path         /usr/bin/xauth
    # Xauth file for server
    authfile           /var/run/slim.auth
    # Activate numlock when slim starts. Valid values: on|off
    # numlock             on
    # Hide the mouse cursor (note: does not work with some WMs).
    # Valid values: true|false
    # hidecursor          false
    # This command is executed after a succesful login.
    # you can place the %session and %theme variables
    # to handle launching of specific commands in .xinitrc
    # depending of chosen session and slim theme
    # NOTE: if your system does not have bash you need
    # to adjust the command according to your preferred shell,
    # i.e. for freebsd use:
    # login_cmd           exec /bin/sh - ~/.xinitrc %session
    login_cmd           exec /bin/bash -login ~/.xinitrc %session
    # Commands executed when starting and exiting a session.
    # They can be used for registering a X11 session with
    # sessreg. You can use the %user variable
    # sessionstart_cmd    some command
    # sessionstop_cmd    some command
    # Start in daemon mode. Valid values: yes | no
    # Note that this can be overriden by the command line
    # options "-d" and "-nodaemon"
    # daemon    yes
    # Available sessions (first one is the default).
    # The current chosen session name is replaced in the login_cmd
    # above, so your login command can handle different sessions.
    # see the xinitrc.sample file shipped with slim sources
    sessions            xfce4,icewm,wmaker,blackbox
    # Executed when pressing F11 (requires imagemagick)
    screenshot_cmd      import -window root /slim.png
    # welcome message. Available variables: %host, %domain
    welcome_msg         Welcome to %host
    # Session message. Prepended to the session name when pressing F1
    # session_msg         Session:
    # shutdown / reboot messages
    shutdown_msg       The system is halting...
    reboot_msg         The system is rebooting...
    # default user, leave blank or remove this line
    # for avoid pre-loading the username.
    #default_user        simone
    # Focus the password field on start when default_user is set
    # Set to "yes" to enable this feature
    #focus_password      no
    # Automatically login the default user (without entering
    # the password. Set to "yes" to enable this feature
    #auto_login          no
    # current theme, use comma separated list to specify a set to
    # randomly choose from
    #current_theme       default
    current_theme        archlinux-darch-white
    # Lock file
    lockfile            /var/lock/slim.lock
    # Log file
    logfile             /var/log/slim.log
    ~/.xinitrc:
    #!/bin/sh
    # ~/.xinitrc
    # Executed by startx (run your window manager from here)
    # exec gnome-session
    # exec startkde
    # exec startxfce4
    # ...or the Window Manager of your choice
    #exec xterm
    setxkbmap -option terminate:ctrl_alt_bksp
    exec ck-launch-session gnome-session
    Regarding whats runs at bootup, I guess you want to see my daemons array in rc.conf, here it is:
    DAEMONS=(syslog-ng dbus hal network netfs crond alsa @cups slim !gdm)
    Notice gdm is disabled.
    Also, would you advice to reinstall gdm? removing it didnt do anything for the problem im experiencing.
    thanks for the help

  • [SOLVED] video card support question

    Hi Everyone,
    I need to get my dad a new pc with a simple (newbee) linux distro on it and I was thinking of something like mint. He has been using Ubuntu the last 2 years but for some reasons we want to switch. I'm a very satisfied arch user but this is way over his head.
    I'm looking for a system without windows and found something with the following specs:
    Cardreaders     3,5" Spire 51-in-1 zwart
    Processor     AM3 AMD Athlon2 X2 255 65W 3.10GHz / BOX
    Motherboard     Biostar AM3 N68S3+ V/S/L/µATX/DDR3
    RAM                     2048MB DDR3/1333 Kingston CL9
    Graphics        5450 ATI HIS HD 5450 Silence VGA/DVI/HDMI/GDDR3 1024MB
    HDD             500GB Samsung HD502HJ SATA/16MB/7200rpm
    Housing       Codegen P6232-A11 460 Watt / zwart-zilver
    DVD-Burner     Samsung SH-222AB 22x SATA / bulk / zwart
    DVD-player     Sony Optiarc 18x/48x SATA / bulk / zwart
    I'm somewhat worried about the graphics card and after browsing the forums I can't get a satisfying answer whether the card will work with or without problems if at all. Can anyone help out or give some advise?
    Thanx a bunch.
    Last edited by billy-bones (2011-06-10 22:30:53)

    billy-bones wrote:
    karol wrote:
    billy-bones wrote:He is not going to do any heavy gaming and such.
    So why do you need 1 GB RAM card?
    He want's do edit video's and work more intensively with multimedia.
    I would suggest getting some more RAM.
    https://bbs.archlinux.org/viewtopic.php … 97#p934697
    Maybe you can ask mhertz some specific questions as he seems to have a 5450 too. Judging from this one post the situation doesn't seem bad.

  • Camileo charging problem (solved) and a general question!

    Hi all!
    First of all, I was going to ask for help as to why the Camileo S10 was not charging (the orange light wasn't flashing), and I'd seen a few people with similar problems.
    The solution?
    Give the contacts on the battery a clean.
    The insulation sticker that comes on it must leave some kind of residue on it, and it's enough to prevent charging. Now it's flashing away happily :]
    So my general question was, is it possible/advisable to use the camera on the mains?
    Rather than constantly draining and charging the battery during long shoots, I'd prefer to just leave it plugged in!
    Thanks very much in advance!
    Paul

    Hi
    I think the battery handling is always the same no matter what product it is
    From time to time the battery should be recalibrated.
    This means that the battery should be discharged fully and after then you should charge it again until the battery would reach 100%
    I do this with all my batteries; mobile phone battery, digi cam battery and notebook battery.

  • [SOLVED]port redirect/routing question

    Hi,
    mypc - router - ( INTERNET ) - another pc
                                               - destination pc
    "another pc" and "destination pc" are both connected to the internet via offical ips, but ports <1024 are blocked.
    "another pc" can connect to "destination pc" via ssh (they are in the same network).
    now i would like to connect to "another pc" and get redirected (dont know how) to "destination pc" port 22
    "another pc" can connect to "destination pc" via ssh, but another pc is not my machine and i would prefer not to put my private key on it. also this solution should only work once.
    This works if i want to connect to some machine inside a private lan over a router connected to the inet, but since "another pc" and "destination pc" are in the same network is nat the way to go?
    iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 222 -j DNAT --to-destination 192.168.10.30:22
    Any ideas?
    greets
    metalfan
    Last edited by metalfan (2007-12-24 17:06:58)

    You need openssh and tsocks
    Run these commands from mypc
    #tsocks configuration
    /etc/tsocks.conf
    server = 127.0.0.1
    #this will start a shell on another, just let it run. port 1080 is the default port...no entry in /etc/tsocks.conf needed
    ssh -D 1080 "another pc"
    #or ssh -l yourloginnameon"another pc" -D 1080 "another pc"    #if its another user on "another pc"
    #on another shell
    tsocks ssh "destination pc"
    took me one day to get this running, thx to Al_Berto@quakenet who solved the mistery.
    greets
    metalfan
    Last edited by metalfan (2007-12-24 17:07:59)

  • Alias in CDE question

    I use the ksh shell in Sun Solaris 8 ,but when I use a CDE(Command Desktop Environment) session , this don't recognize the alias alocated in my ".profile".
    What can I do?

    For your user .....
    cd $HOME
    vi .Xdefaults
    Dtterm*loginShell: True
    wq!
    exit out of CDE or refresh your resources. When you return it will work ;)
    see man dtterm.
    or run from a dtterm ...."dtterm -ls" this will also ensure your .profile is sourced.
    For all users .... add the resource in /usr/dt/config/C/sys.resources

  • [SOLVED] Alias in Apache

    Hi,
    I am attempting to set up a webserver that will host multiple sites on the same computer. This is just a dev workstation, so it will not have a domain name pointing to it, I just want to be able to keep projects in different locations.
    That being said, I am investigating the use of an alias (instead of virtual hosts). I sucessfully set up an alias to point /projectname to /home/<username>/project/location. When I visit the project name in a browser I am getting a 403 Access Forbidden. How can I set up permissions on this folder so that I can edit files without having to sudo every time but so that the web server can access them as well?
    Thank you!
    Last edited by Abadon125 (2012-02-08 16:10:51)

    Yeah, agreed!
    A better way to do this is described in the Wiki link I posted.  That is, first add the 'http' user to the 'users' group, then give execute and read privileges to the 'users' group (that should be sufficient for most of your project dir).  You're better off not giving write and execute to everyone else, for obvious reasons. You will also need to give group level read and execute privileges to your user's home directory ~/ and the directories leading to your source.  Otherwise Apache cannot transgress the path to the source directory. Something like this should do the trick (with root privs):
    usermod -aG users http
    chmod 755 /home/username
    chmod -R 754 /home/username/projects
    Personally, I have my development source in various directories under ~/Public_html and ownership/group set to harlequin:harlequin.  That way, by adding Apache to my own user group I don't in inadvertently grant access to other users' folders as well. That's just my preference, though.
    If that fails, make sure you have defined the appropriate default index files for the directory if httpd.conf doesn't have global defaults set:
    Alias /projectname /path/to/project/src
    <Directory /path/to/project/src/>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
    Order allow,deny
    Allow from all
    </Directory>
    Also: I forgot the final '/' in the Directory tag on my previous post. Sorry.
    Last edited by C. M. Harlequin (2012-02-07 19:16:43)

  • [SOLVED] Kind of Bash-Timeout?

    Hello everyone. 
    First I must say something good about Arch. I love this distribution and in my eyes its one of the (or even THE) best linux you can find.
    I've got a strange problem with my Archbox. And since I even don't know how to call it, I can't find a similar post.
    When I don't use my PC, for example while hearing music, the screen turns of after about 10 minutes. I recognized this behaviour in runlevel 3 and 5. My desktop is a openbox WM and no screensaver-tool.
    I searched a lot in diverse configuration-files, but never found an entry whose name matched this behaviour.
    Hope someone knows how to solve.
    Big thanks in advantage,
    armageddon
    PS.: Please excuse my English, I'm a still learning german.
    Last edited by the.armageddon (2009-02-11 11:32:00)

    Welcome to arch and the forums
    Probably you are seeing the "builtin" X screensaver. Try typing
    xset q
    in a terminal and look in the output for something like
    Screen Saver:
    prefer blanking: yes allow exposures: yes
    timeout: 600 cycle: 600
    If you want to deactivate just use "xset s off". Other options to xset allow you to configure the behaviour to your likes.

  • [SOLVED] vmware/virtualbox hybrid question

    Good Afternoon Fellow Archers,
    I have one Windows directX game that will run on native Windows, or in VMWare player, not VirtualBox.
    But I prefer VirtualBox for the way it performs on my C Compiler and other Windows centric stuff I have to do. I could list a bunch of reasons why I don't want to dual boot, and why I need to run Windows. Suffice to say, I use Arch for everything I need, and then WIndows for the customers I have to support.
    I have one DirectX game that does not run properly under VB, but works perfectly under VMWare.
    Question:
    Can I have both installed simultaneously? VMWare for the one personal DirectX game I want, and then VB for everything else?
    For the record: They would never be ran at the same time.
    Advice is greatly appreciated!
    Sincerely and Respectfully,
    Dave............
    Last edited by dcbdbis (2011-04-22 04:34:24)

    Thank you for the response. I appreciate it. I just thought it wiser to ask rather than risk borking my system.
    I knew that they both use their own kernel mods.....but I wanted a little reassurance.
    Again, Thank You!
    Dave.

  • [Solved] [audacious-git] dependency question

    Hi, I maintain audacious-git and audacious-plugins-git and have a question:
    audacious-plugins-git should be a dependency of audacious-git.
    On the other side audacious-git should be a makedependency of audacious-git.
    This is the case for the packages from [extra] (of course without -git)
    How is it now possible to compile audacious / audacious-plugins if both packages are not installed?
    And how should I handle this in the PKGBUILD?
    Thanks for an answer
    Radioactiveman
    Last edited by Radioactiveman (2011-06-24 12:32:59)

    The audacious-plugins package need only be a dependency of audacious for usability reasons: it is not required to build it. So it is easy to "manually" bootstrap by first compiling an audacious PKGBUILD without the audacious-plugins dependency. In the AUR, of course, that's not so handy, and I believe the best solution to your issue is to have audacious-plugins-git as an optdepends (not a depends) in the audacious-git PKGBUILD, and remind your users that they very likely want to install it.

  • Quick Bash Question

    I'm trying to write a simple bash script which downloads the compat-wireless drivers and installs them. The script works fine but i'm trying to learn bash and would like to make it a bit nicer to look at and add some more functionality. What I have done is used grep to pull out the percentage of the download, however every number prints on a new line like so:
    1%
    2%
    3%
    4%
    5%
    6%
    etc.... What I'm trying to do is replace the last percentage with the next one, so it's all on one line. I've had a look around and found that a way to do what I'm trying to do is with:
    tput cbt
    or with the bash escape codes directly. Now the thing is I don't know where I should put this in my code, could anyone help?
    #!/bin/bash
    #Retrieve latest compat-wireless soruces
    echo -e "Downloading sources\n"
    wget http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2 |& grep -o "[0-9]\+%"
    if test -fs compat-wireless-2.6.tar.bz2 then
    echo "File Downloaded OK"
    else
    echo "Download Failed, Exiting."
    exit
    fi
    #Untar folder
    echo "Extracting sources"
    tar jxvf compat-wireless-2.6.tar.bz2 > /dev/null
    #Enter build folder
    cd compat-wireless-*
    #Select ath9k as driver to build
    ./scripts/driver-select ath9k
    #Compile sources
    make
    #Install sources
    sudo make install
    #Unload wireless modules
    sudo make unload wireless
    #Reload ath9k module
    sudo modprobe ath9k
    #Return to original directory
    cd ..
    #Remove traces of install files
    sudo rm -r compat-wireless-*

    Ok, so I've tried
    #Retrieve latest compat-wireless soruces
    echo -e "Downloading sources\n"
    wget http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2 |& printf "\r `grep -o "\r[0-9]\+%"`"
    To no avail, am I doing this correctly, or at least on the right lines? I can't seem to find any examples where a command is used within a printf statement.
    Thansk for the help so far!
    edit: Just a thought, could I possibly encompass the grep command into a variable and then pipe it into a printf statement?
    Last edited by jack.mitchell (2011-01-18 15:50:19)

Maybe you are looking for