I have a simple script, that is essentially a list of dpkg -i ... commands in a chroot.  It looks something like this:  chroot /path/to/chroot /bin/bash -e &lt;&lt; EOF cd /opt  dpkg -i package1_*  dpkg -i package50_* dpkg -i package51_*  dpkg -i package100_*  EOF   The problem is, when I call the script like, bash -c "script here" or bash &lt;( echo "script here" ), i get an error message.  The error message looks something like:   Selecting previously unselected package libss2:i386. (Reading database ... 1376 files and directories currently installed.) Preparing to unpack libss2_1.42.9-3ubuntu1_i386.deb ... Unpacking libss2:i386 (1.42.9-3ubuntu1) ... Setting up libss2:i386 (1.42.9-3ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6.5) ... /bin/bash: d: not found   It seems like the code is cut off at d(pkg -i ...).  I changed the dpkg that is being cut off to an echo. The error message stayed the same, only that now e is not being found.  I could of course save the script in a temp file and call it, since that works. But I would like to know what is happening here. The cutoff mark (including the 'd') is at the 1048 byte point.
123436
I'm running the following script on Ubuntu 14.04:  #!/bin/bash  apt-get purge -y nginx apt-get install -y nginx  date   When I run it like cat /tmp/script | bash, apt-get starts installing, then "date" is printed (not the actual date, but the command name), then the remaining apt-get output is printed.  If however I run the script like /tmp/script, it works as expected: printing the date after apt-get finished.  Why does this happen and how can I force bash to work when being piped to the same way it does when invoked directly?
39582
Suppose I download a .deb package from a website and install it. (I assume that when I double click the .deb file, the package is installed through a GUI that interfaces with dpkg right?)  How can I uninstall it?
31152
I want to install Open JDK or Oracle JDK to my machine but I got an error during installation. The error is:  Selecting previously unselected package oracle-java8-installer. dpkg: warning: files list file for package 'unity-scope-gourmet' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-guayadeque' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-gmusicbrowser' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-manpages' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-firefoxbookmarks' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-gdrive' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'unity-scope-home' missing; assuming package has no files currently installed E: Sub-process /usr/bin/dpkg returned an error code (2)   I searched on Google and try to something for install/reinstall this packages. Finally i try to remove Unity. I faced this error for my every tries. I am using Xmonad. How can I fix this issue?
91369
The way you would normally include a script is with "source"  eg:  main.sh:  #!/bin/bash  source incl.sh  echo "The main script"   incl.sh:  echo "The included script"   The output of executing "./main.sh" is:  The included script The main script   ... Now, if you attempt to execute that shell script from another location, it can't find the include unless it's in your path.  What's a good way to ensure that your script can find the include script, especially if for instance, the script needs to be portable?
58170
I have installed pulseaudio-module-bluetooth using apt.  $ type pulseaudio-module-bluetooth bash: type: pulseaudio-module-bluetooth: not found $ which pulseaudio-module-bluetooth $ whereis pulseaudio-module-bluetooth pulseaudio-module-bluetooth:   Clearly, I'm looking for the wrong thing.  The package does not simply install a command that is the same name as the package.  Alright, then.  I want to find out what all commands (or executables) this package installed, and their locations.  The answers to "" tell me how to find the files installed by the package if I have a .deb file.  I'm not installing directly from a .deb file, though.  I'm using apt.  Where is the .deb file that that used?  Is there a copy on my system somewhere that I can query with the commands in the answers to that question?  Where?  If there isn't a local copy on my system, can I get one with apt?  How?  Is there some handy apt (or similar) command that wraps this up for me, so that I do not have to run dpkg-deb directly?  What is it?  Can I find the package's file list entirely on-line, without explicitly downloading any .deb files and before installing anything with apt?  How?
74419
I'm trying to install folding at home, and running into an issue with FAHControl package  $ sudo dpkg -i fahcontrol_7.5.1-1_all.deb Selecting previously unselected package fahcontrol. (Reading database ... 318495 files and directories currently installed.) Preparing to unpack fahcontrol_7.5.1-1_all.deb ... Unpacking fahcontrol (7.5.1-1) ... dpkg: dependency problems prevent configuration of fahcontrol:  fahcontrol depends on python-gnome2; however:   Package python-gnome2 is not installed.  dpkg: error processing package fahcontrol (--install):  dependency problems - leaving unconfigured Processing triggers for gnome-menus (3.32.0-1ubuntu1) ... Processing triggers for desktop-file-utils (0.24-1ubuntu1) ... Processing triggers for mime-support (3.63ubuntu1) ... Errors were encountered while processing:  fahcontrol   , so what is the best way to proceed?  I see in the  that FAHControl isn't required, but would be nice to get it working.
20789
I have accidentally removed apt-get, how do I reinstall it?  $ sudo apt-get update sudo: apt-get: command not found  $ sudo dpkg-reconfigure apt /usr/sbin/dpkg-reconfigure: apt is broken or not fully installed    I would like to mention I do not want to reinstall Linux!
52065
I've been trying to install Android developer tools on Eclipse, and I followed the information in .  Like the video said, I added the following two lines of code to the .bashrc file:  export PATH=$(PATH):-/android-sdk/tools/ export PATH=$(PATH):-/android-sdk/platform-tools/   It seems, however, that this did not help me to install the Android files on Eclipse, as I am still having problems with that. What's more, it seems that I can't make any command in the terminal without getting a major error now! Every time I try to make a command in the terminal I get the following message:     The command could not be located because '/usr/bin' is not included in   the PATH environment variable.   Is there away to restore .bashrc to its default?
11125
Installing Deb packages on the command line, using dpkg -i, only installs the package in question and displays errors of unresolved dependencies (manually solved by apt-geting the packages it complains about). How do I automatically resolve dependencies when installing standalone packages?
112793
I am writing a bash script to automate several actions:  #!/bin/bash           echo "Hello, World" NAME="${1}" PATH="${2}" echo $NAME echo $PATH eval "ls"   I am going to call ls, ffmpeg and a lot of other commands.  However running my script gives me the following error:  /var/www/html# ./life.sh test midhand.mp4 + ./life.sh test midhand.mp4 Hello, World test midhand.mp4 ./life.sh: line 9: ls: command not found   How come? why not found? Maybe I should import a directory with scripts?
10868
If script.sh is just something typical like  #!/bin/bash echo "Hello World!"   Is there a preferred way to run the script? I think you first have to chmod it so it becomes executable?
94692
I have a script called jsl in /usr/local/bin. Running which jsl finds it there.  I want to temporarily use a different version, and when I echo $PATH I see that /usr/bin is earlier in the path. So I added a script called jsl in that folder and I've verified that it is executable and runs correctly when called with the full path.  However, which jsl still finds the first version, and jsl still runs it.  Why isn't my new jsl being found by which or executed by name?
60999
Whatever I try to run, I get the error:   The command could not be located because '/usr/bin' is not included in the PATH environment variable.   I had some modification in my .bashrc file but then removed the two additional lines afterwards. However somehow the PATH variable seems to have been destroyed.
122298
I have noticed that while on Ubuntu, if I type the following:  mc   and it isn't installed, I get the message below:  The program 'mc' is currently not installed. You can install it by typing: sudo apt-get install mc   However in Debian, that is not available. It just gives a "-bash: /usr/bin/mc: No such file or directory" message. How can I implement the same functionality in bash command line on Debian? Yes, I know that if it is package suggestion that I want, I can simply do a regex search using apt-cache search. However I was hoping for the simpler suggestion immediately on typing the name of the program.  As per discussions, the functionality is provided by the package command-not-found. However even after installing it, and also installing bash-completion package, this isn't available on the Debian bash shell.
27654
I have a script which finds files in the directory specified by user.    #!/bin/bash  # make sure about the correct input if [ -z $1 ] then     echo "Usage: ./script_name.sh    path/to/directory" else     DIR=$1     if [ $DIR = '.' ]     then          echo "Find files in the directory $PWD"     else           echo "Find files in the directory $DIR"     fi      find $DIR -type f -exec basename {} \;  fi   if I input    $ ./script_name.sh .   script gives me correct substitution ./ to $PWD and shows (for example)    $ Find files in the directory /root/scripts     But I can't make a decision how to substitute ../ to the name of the directory  immediately above in the hierarchy.  If I input    $ ./script_name.sh ..     script gives me the output    $ Find files in the directory ..     Does anybody know how to substitute ../ to the actual name of the directory?
84601
In an attempt to learn more about Ubuntu and its packages, I want to remove all non-essential packages, so I can install what I need, when I need them and know what they do.  I'm using the commands dpkg --clear-selections and apt-get dselect-upgrade for this. I also slightly modify the selection by setting apt libstdc++6 (due to apt) install-info (due to grep) to install again (somehow dpkg thinks they are not essential, but apt-get complains).  Is this ok, or is this bad? If it's ok, what do I do with the large list of packages with "deinstall" status in dpkg?  An additional note, I'm doing this on a VPS template so I have no control over the initially installed packages.
14491
I tried to create a script by echo'ing the contents into a file, instead of opening it with a editor  echo -e "#!/bin/bash \n /usr/bin/command args"  &gt; .scripts/command   The output:     bash: !/bin/bash: event not found   I've isolated this strange behavior to the .  $ echo ! !    $ echo "!" bash: !: event not found  $ echo \#! #!  $ echo \#!/bin/bash bash: !/bin/bash: event not found    Why is bang causing this?   What are these "events" that bash refers to?     How do I get past this problem and print "#!/bin/bash" to the screen or my file?