[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"

Similar Messages

  • [SOLVED] Make Bash Completion Error (Command Not Found)

    When attempting to tab complete the `make` command, I am met with the following when I hit tab:
    $ make s[tab]bash: 23:set: command not found
    Strangely, if I continue hitting tab, it seems to work eventually, but with the same error popping up:
    $ make s[tab]bash: 23:set: command not found
    ched.[tab]bash: 23:set: command not found
    [tab]bash: 23:set: command not found
    sched.1.gz sched.tar.gz
    $ make sched.
    I've never seen anything like this.  I've tried reinstalling bash completion and make to no success.  The Makefile itself is fine and functional.  Other programs' bash completions seem to work just fine.  Help!
    Last edited by goakley (2014-03-23 13:56:50)

    It seems the problem no longer occurs.  The only change that seems to have happened is a bash-completion upgrade that happened yesterday.  I'm a bit disappointed to have not found the actual issue.

  • [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] bash: $'\302\240grep': command not found [frequent CLI error]

    For the past several days I've been getting the following error frequently on the command line:
    bash: $'\302\240grep': command not found
    I think I'm only getting this error in response to commands that are piped to grep, such as the following:
    $ ps -ef | grep xyz
    or
    $ locate | grep abc
    However, I don't think I've gotten the error if I type the same commands as above, but without the space between '|' and 'grep'.  And, although the error is frequent, it doesn't happen every time; it is seemingly random.
    Anybody else experiencing this?  Any idea what might be causing it? 
    I'm using rxvt-unicode as my terminal.
    Jay
    Last edited by jt512 (2011-04-06 04:38:56)

    anonymous_user wrote:Post your ~/.bashrc
    # Check for an interactive session
    [ -z "$PS1" ] && return
    function timer () {
    at -f /home/jay/.timercmd now + $1 min
    function cpufs () {
    sudo cpufreq-set -c 0 $1 $2
    sudo cpufreq-set -c 1 $1 $2
    alias ls='ls --color'
    alias kc='~/scripts/kc.py'
    alias diff='colordiff'
    alias s2ram='sudo s2ram -f'
    alias grep='grep --color=always'
    alias Terminal='Terminal -T Terminal'
    alias emacsnw='emacs -nw -f menu-bar-mode'
    alias rm='rm -I'
    alias lpstd='lp -o "StpQuality=Standard"'
    alias paps='paps --paper letter --font="Courier 10"'
    alias mp='mplayer'
    alias mps='mplayer -softvol-max 600'
    alias mysql='$HOME/scripts/mysql'
    if [ $TERM = 'linux' -a $SHELL = '/bin/bash' ] ; then
    PS1='\033[?17;0;40c[\u@\h \W]\$ '
    else PS1='[ \[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;31m\]\W\[\e[m\] \[\e[m\]]\[\e[0;32m\] \$ \[\e[m\]'
    fi
    eval `dircolors -b`
    # Allow tab completion for sudo'ed commands
    complete -cf sudo
    export PATH=$PATH:~/.local/usr/bin
    export EDITOR="vim"
    export BROWSER='conkeror:uzbl-browser:firefox'
    export GREP_COLOR="1;33"
    export LESS_TERMCAP_mb=$'\E[01;31m'
    export LESS_TERMCAP_md=$'\E[01;31m'
    export LESS_TERMCAP_me=$'\E[0m'
    export LESS_TERMCAP_se=$'\E[0m'
    export LESS_TERMCAP_so=$'\E[01;44;33m'
    export LESS_TERMCAP_ue=$'\E[0m'
    export LESS_TERMCAP_us=$'\E[01;32m'
    export SWEAVE_STYLEPATH_DEFAULT="TRUE"

  • Cisco 3560 GNU Bash Environment Variable Command Injection Vulnerability

    Does this model 3560 is affected by this vulnerability? If does are there any configuration is required to solve this Bash Code Injection Vulnerability issue? Thanks guys!

    I'm seeing things like this. Whenever I look up the victim IPs they resolve to Amazon servers. It looks like a false positive to me also.
    event_id = 1360033965674082135
    severity = high
    device_name = xxxxxxx
    app_name = sensorApp
    receive_time = 09/28/2014  06:32:59
    event_time = 09/28/2014 10:33:29
    sensor_local_time = 09/28/2014 06:33:29
    sig_id = 4689
    subsig_id = 1
    sig_name = Bash Environment Variable Command Injection sig_details = CVE-2014-6271 sig_version = S824 attacker_ip = xxx.xxx.xxx.xxx attacker_port = 50986 attacker_locality = OUT victim_ip = 54.204.5.190 victim_port = 80 victim_os = unknown unknown (relevant) victim_locality = OUT summary_count = 0 initial_alert_id = summary_type = is_final_alert = interface = GigabitEthernet0/1 vlan = 0 virtual_sensor = vs0 context = bGVicml0eWJhYmllcy5wZW9wbGUuY29tJTdDYWlkJTNEMjA4OTQ1JTdDY2glM0RiYWJpZXMlN0NzY2glM0RuZXdzJTdDcHR5cGUlM0Rjb250ZW50JTdDY3R5cGUlM0RibG9nJTdDcGFnZSUzRDElN0NzdWJqJTNEYmFiaWVzJTJDa2FueWUtd2VzdCUyQ2tpbS1rYXJkYXNoaWFuJTJDbmV3cyU3Q2NlbGViJTNEJTdDdW5pcXVlJTNEZnVuY3Rpb24rKCkrJTdCJTBBKysrKysrKysrKysrdmFyK2ErJTNEKyU1QiU1RCUyQ2srJTNEKzAlMkNlJTNCJTBBKysrKw==$
    actions = droppedPacket+deniedFlow+tcpOneWayResetSent
    alert_details = InterfaceAttributes:  context="single_vf" physical="Unknown" backplane="GigabitEthernet0/1" ; risk_rating_num = 100(TVR=medium ARR=relevant) threat_rating = 65 reputation = protocol = tcp

  • Can't run bash or sudo commands

    I have a Mac Pro with OS X 10.8.2 and also an older iMac running OS X 10.6.8. On neither Mac can I run any bash or sudo commands! I always get command not found.
    Both Macs have fresh installs of OS X, did I forget to install something? Is X11 needed? or Xcode?
    Thanks for any help.

    Back up all data.
    Select
    Shell ▹ New Command
    from the Terminal menu bar. Copy and paste the following line into the text box that opens:
    mkdir disabled_shell_files; mv .profile .bash* $_
    Your old shell initialization and history files will be saved in a directory with the indicated name at the top level of your home directory.

  • Challenging question! (Does anyone how to solve this Javabat question?)

    Does anyone how to solve this Javabat question?
    Here is the link:
    http://www.javabat.com/prob?id=Array3.linearIn

    I'm a little surprised by the implied rating of this problem... it's a plain to-way merge. You can use the same template as for the merging step in merge sort:
    public boolean linearIn(int[] outer, int[] inner) {
      int i = 0;
      int j = 0;
      while (i < outer.length || j < inner.length) {
          if (j < inner.length && (i == outer.length || inner[j] < outer)) {
    // inner[j] smallest
    return false;
    else if (i < outer.length && (j == inner.length || outer[i] < inner[j])) {
    // outer[i] smallest
    i++;
    else {
    // inner[j] == outer[i]
    i++; j++;
    return true;

  • Bash: $'\302\211cat': command not found

    Fresh Arch install. 
    I tried running some commands in startx xterm (e.g., cat, vim), but got this error message:
    [user@machine ~]$ cat /etc/wpa_supplicant/wpa_supplicant.conf
    bash: $'\302\211cat': command not found
    How can I fix this?
    wpa_supplicant.conf exists.
    Last edited by PauseUser (2014-07-11 14:16:04)

    A bad PS1 should not create such issues.  A bad PS1 can create very odd visual artifacts, but the shell will still get the proper input.
    I'm guessing the whole command was copied/pasted from somewhere else (eg a website).  Rather than just copying the text, if some formatting was copied, it could easily create such an issue.
    If this were due to a PS1 issue, the OP would get such errors with every single command entered in a terminal.

  • False Positive on Sig 4689/1 Bash Environment Variable Command Injection

    I am seeing what I believe is false positives on Sig 4689/1 outbound from our network. When I look at the traffic capture from events it does not seem to match inbound traffic events that fire on the same signature. The inbound traffic looks very much like what I think is the exploit code for the Bash injection vulnerability. 
    Any one else seeing this on their systems?
    Mike

    I'm seeing things like this. Whenever I look up the victim IPs they resolve to Amazon servers. It looks like a false positive to me also.
    event_id = 1360033965674082135
    severity = high
    device_name = xxxxxxx
    app_name = sensorApp
    receive_time = 09/28/2014  06:32:59
    event_time = 09/28/2014 10:33:29
    sensor_local_time = 09/28/2014 06:33:29
    sig_id = 4689
    subsig_id = 1
    sig_name = Bash Environment Variable Command Injection sig_details = CVE-2014-6271 sig_version = S824 attacker_ip = xxx.xxx.xxx.xxx attacker_port = 50986 attacker_locality = OUT victim_ip = 54.204.5.190 victim_port = 80 victim_os = unknown unknown (relevant) victim_locality = OUT summary_count = 0 initial_alert_id = summary_type = is_final_alert = interface = GigabitEthernet0/1 vlan = 0 virtual_sensor = vs0 context = bGVicml0eWJhYmllcy5wZW9wbGUuY29tJTdDYWlkJTNEMjA4OTQ1JTdDY2glM0RiYWJpZXMlN0NzY2glM0RuZXdzJTdDcHR5cGUlM0Rjb250ZW50JTdDY3R5cGUlM0RibG9nJTdDcGFnZSUzRDElN0NzdWJqJTNEYmFiaWVzJTJDa2FueWUtd2VzdCUyQ2tpbS1rYXJkYXNoaWFuJTJDbmV3cyU3Q2NlbGViJTNEJTdDdW5pcXVlJTNEZnVuY3Rpb24rKCkrJTdCJTBBKysrKysrKysrKysrdmFyK2ErJTNEKyU1QiU1RCUyQ2srJTNEKzAlMkNlJTNCJTBBKysrKw==$
    actions = droppedPacket+deniedFlow+tcpOneWayResetSent
    alert_details = InterfaceAttributes:  context="single_vf" physical="Unknown" backplane="GigabitEthernet0/1" ; risk_rating_num = 100(TVR=medium ARR=relevant) threat_rating = 65 reputation = protocol = tcp

  • What is happening about: The GNU Bourne Again Shell (Bash) is a command line utility widely used in many Unix-based operating systems including Linux and OS X.  Researchers have discovered a critical flaw in Bash which could allow remote code executi

    Authoritative advice today:
    The GNU Bourne Again Shell (Bash) is a command line utility widely used in many Unix-based operating systems including Linux and OS X.
    Researchers have discovered a critical flaw in Bash which could allow remote code execution by an unauthenticated user
    APPLE response?

    Also see:
    http://www.macrumors.com/2014/09/26/apple-os-x-users-safe-bash-flaw-update-soon/
    If you are not running a web server
    If you have not enabled CUPS web interface
    If you do not allow anonymous users to ssh into your Mac.
    If all are no, they you are not at risk.
    This IS a very serious bug for web servers, but the typical consumer Mac user is not at risk.

  • [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..

  • [SOLVED]bash: assign a command output to a variable

    EDIT: Sorry, got the solution - the variable was good, I just forgot a "do" in a "for" loop.... Sorry
    Hi erveryone.
    I'm just starting to learn the basics of bash scripting, and I got a problem assigning the output of a command to a variable, and i keep getting syntax errors...
    var=$(cut -d: -f1 foo)
    echo $var
    A google search gives many different ways to do this, but without better results..
    var=`cut -d: -f1 foo`
    var="`cut -d: -f1 foo`"
    Any idea what I'm doing wrong?
    Thanks!
    Last edited by haiku (2012-02-01 14:19:00)

    haiku wrote:var=$(cut -d: -f1 foo)
    var=`cut -d: -f1 foo`
    The first two are both 'right' (in bash) but the first is the preferred syntax (in bash).  I think sh only understands the second.  I've never used quotes in a situation like this, but it seems to work.  That said, maybe the problem is the command itself, because all variations work for me:
    $ cat foo
    genmon1a:genmon1b
    genmon2:genmon3:genmon4
    $ cut -d: -f1 foo
    genmon1a
    genmon2
    $ D=$(cut -d: -f1 foo)
    $ echo $D
    genmon1a genmon2
    $ D=`cut -d: -f1 foo`
    $ echo $D
    genmon1a genmon2
    $ D="$(cut -d: -f1 foo)"
    $ echo $D
    genmon1a genmon2
    $ D="`cut -d: -f1 foo`"
    $ echo $D
    genmon1a genmon2
    It might help if you could give us some of the 'bigger picture' too: what you are trying to do overall, the contents of foo, what you are trying to do with the variable, etc.
    Last edited by alphaniner (2012-02-01 14:31:01)

  • [SOLVED]A simple question about bash scripting

    Just for fun, I thought I'd try making Arch as "parent friendly" as possible (i.e., easy to use once set up).  I've already made a nifty little "system maintenance" script that presents you with a "select" bash menu, with options being "Install, Remove, Update [Without AUR, with AUR, abs, exit], Search, Install and Search (using Yaourt), and exit"
    That works wonderfully, and it only requires typing "sm" into the terminal.
    But just to make it yet *more* "parent friendly", I thought I'd make a .desktop file.
    This is the problem.
    I want the shortcut to essentially open up the script in a terminal.  So it would have to execute, say, "xterm" and then open the "sm" script within the called terminal.
    I believe this would mean I need to either add something to my "sm" script or make a new script that opens terminal and calls sm.
    I'm sure this has an easy solution, but I'm a total amateur just having some fun.
    Any suggestions?
    Last edited by hwkiller (2010-07-13 00:32:48)

    I am not a 100% on .desktop files since I never use them.
    but if your command in the desktop file is something like
    xterm -e /path/to/your/sm/file
    that should work.
    EDIT: Bah too late !
    Last edited by Inxsible (2010-07-12 19:27:11)

  • Bash: wrapping long command line [SOLVED]

    I'm trying to configure my bash to wrap long command lines.  I am looking for a behaviour similar to tcsh where, at the border of the window,  the command is continued on the next line.  In bash, the command continues at the begining of the same lines wich is messy.  I tried using
    set horizontal-scroll-mode on
    in my ~/.inputrc but the continuation doesn't start at the windows border. I can post screenshots if that would help.
    Thanks.

    putting the line in .bashrc have no effect.
    Here is my .bashrc
    export EDITOR=emacs
    export PAGER=less
    export LESS="-f -r"
    export BROWSER=firefox
    PS1='[33[01;34m]#[33[00m] 33[01;31m]u@H[33[00m]33[01;39m] w $33[00m] '
    # create an xauth key for root user
    umask 377
    /usr/X11R6/bin/xauth extract /tmp/user.xauth $DISPLAY
    umask 022
    #set horizontal-scroll-mode on
    source ~/.aliases
    my .bash_profile
    . $HOME/.bashrc
    my .inputrc
    "e[A": history-search-backward
    "e[B": history-search-forward
    set show-all-if-ambiguous on
    set page-completions off
    set completion-query-items 10000
    set horizontal-scroll-mode on
    The screenshots:
    With tsch (what I'm looking for)
    With set horizontal-scroll-mode off:
    If I continue to press the 'a' key, it overwrite the whole line and wraps at the window border.
    With set horizontal-scroll-mode on:
    It wraps 2 inches before reaching the window border.
    [/img]

Maybe you are looking for