Tag Info

New answers tagged

0

Another solution that I used is based on Upstart, a quite powerful stuff. Maybe you don't need it at all. http://upstart.ubuntu.com/cookbook/ Let's create a file in your home /home/your_user_name/scripts/my_script.conf with this content: # my_script.conf description "here goes the description for my_script" author "Peter Farkas @ InDaLine" # Stanzas # # ...


0

How to Screensaver using image from directory. Test this: Open a terminal. Execute: sudo su nano /etc/apt/sources.list **On file, paste these lines: ---------------------------------------------------------------------- deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted deb-src http://old-releases.ubuntu.com/ubuntu/ lucid main restricted ...


1

Considering your requirement of running a job when you login to Unity and not for other logins, an Upstart session job seems perfect. You may have noticed it: processes that you run after a GUI login are under a second init process. This init is a proper Upstart init, and you can start and stop session jobs based on events emitted by it. No root privileges ...


1

To get this working use the following: [Desktop Entry] Version=1.0 Type=Application Name=Play Comment=Play music Exec=bash /home/awesome/Desktop/test/play.sh Path=/home/awesome/Desktop/test/ Icon= Terminal=true GenericName=Player


0

Well, I've found a crazy workaround. So, I thought I'd share. I'm not expecting it to be the accepted answer, however (but it works). It may or may not be dangerous. That is to copy xfc4-session-settings from /usr/bin into the bin folder of all the users that I actually want to be able to use it (e.g. /home/sally/bin). Then, delete it from /usr/bin. So, all ...


0

As for your code: Do not put error messages to STDOUT, there is STDERR for them. Do not forget to enclose filenames (and veriables in general) in quotes. tar xjf $1 would not work if $1 contains spaces. gunzip and bunzip2 without -k (--keep) option delete compressed file after decomressing. Are you sure you want it? GNU tar can detect compression format by ...


0

Edited... I think you're looking for an 'init script' solution. There is a simple example here: http://unix.stackexchange.com/questions/6697/run-python-script-on-startup and another one here: http://mobiarch.wordpress.com/2014/05/16/creating-an-init-script-in-ubuntu-14-04/ Briefly: You put your script to e.g. /usr/local/bin/my_script.py (it's not ...


2

In awk, awk -F" : " '/^String/ {string = $2}; /^needed/ {print string, $0}' f1.txt You can do a similar thing in sed, although it's not quite so compact - basically it uses sed's hold space as the equivalent of the string variable. Unfortunately AFAIK there's no simple way to prepend the hold space to the pattern space in sed, so we have to append and ...


0

Here's an example script that does this: http://paste.ubuntu.com/8186522/ I have made a few assumptions: Your assignment is going to use : as the separator. I have taken advantage of this in setting the IFS for read. You don't mind going over the file multiple times. This can be done in one pass, in fact might be easier that way, depending on the ...


0

Here are some suggestions for running a script after login: StackOverflow Linux script after bootup: Cliff notes is to put your *.sh file in /etc/profile.d. If you want to run scripts upon bootup, here are some suggestions for that: StackOverflow Linux script after boot: Cliff notes is to use /etc/rc.local or crontab.


1

I had the same problem but was not very happy with the solutions here or the solutions did not work for me. What I found out to get it running is to send a NULL input to apt-get, so that it continues to work. It looks like this: apt-get -y install gcc g++ make cmake perl < "/dev/null" cd ~/ mkdir t1 cd t1 #newline Hope other people can use this ...


0

In my .bashrc, I define a function, screenshot to use ImageMagik: screenshot () { import -window root ~/var/screenshot/$(tshhmmss)_screendump.png } and, for the timestamp, alias tshhmmss='date +%y%b%d-%H%M%S' Then, wrapping it in while sleep 5 ... is easy.


1

Yes: #! /bin/bash while sleep 5 do shutter -f -o 'myshot-%T.jpg' -e done The sleep command can take various time durations as arguments: 5s (or just 5) for 5 seconds, 129m for 129 minutes, etc. The shutter command supports JPEG output, and the %T tells Shutter to automatically replace that part with the time of the script. (There's also %NN to ...


0

Use vimdiff... Normal syntax : vimdiff file1 file2


0

You could try to change synclient touchpadoff=0 to synclient touchpadon=1 and at right" styles rotate half and erase" rotate half. and it might work fine this way.


-1

Change the script to xrandr|grep " connected" |awk '{print $5}' as Charles suggested.


1

OK here is a real fix first open a terminal sudo gedit~/.bashrc Find this section and add a # to the line like in the code I pasted below, this will let you chane the names of terminals and your original code is fine. case "$TERM" in xterm*|rxvt*) # JEFFYEE REMOVED because it makes commands to title() not work ...


0

Use wmctrl -r :ACTIVE: -b toggle,above use toggle instead of add (reason : Source) For bottom right, i am working and will update this answer.


1

This sounds suspiciously like a homework assignment*, but here we go. Why would you source the ELABORATO.SH script? If you do and it has an exit statement or errors out, your TEST.SH does the same. I don't think that's what you want. I would just run the script: bash ELABORATO.SH param1 param2 Did you think about redirecting its input? bash ...


3

When you call the script, a new child shell is invoked to run it. Its proxies are set, but the proxy of the parent process (your shell) can't be changed from a child process. Try sourcing the script, i.e. call it like . setproxy 21 Then the script will be interpreted by your current shell.


1

How about while server-is-not-running; do try-and-start-server sleep seconds-to-wait done where server-is-not-running is your current test to see if the server is running, i.e. a shell function or an external command returning non-zero if the server is running (alternatively, ! server-is-running if that function or command returns zero if the ...


1

Just make an infinite while loop: #!/bin/sh while [ TRUE ]; do check_server_status 10.0.. etherwake ff:ff.. done


-1

Does the file exist and do you have read permissions on it. Is it executable, it's directory path needs to be executable. The commands ls -l and chmod will help. Secondly your terminology is a bit microsoft, sh files which execute more like .bat files and binaries which ms calls .exe.


1

Assuming you wish to run this script every time your machine boots, a convenient way is to add an upstart init task. Create a file my-startup-script.conf (its name is up to you, but it must have extension .conf) in /etc/init, containing the following: description "Describe what the script does." start on filesystem task script cd /path/to/script ...


1

Meld is a really great tool. But you can also use diffuse to visually compare two files: diffuse file1.txt file2.txt


3

Litteraly sticking to the question (file1, file2, outputfile with "has changed" message) the script below works. Copy the script into an empty file, save it as compare.py, make it executable, run it by the command: /path/to/compare.py <file1> <file2> <outputfile> The script: #!/usr/bin/env python import sys file1 = sys.argv[1]; file2 ...


9

Or you can use Meld Diff Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and has support for many popular version control systems. Install by running: sudo apt-get install meld Your example: Compare directory: Example with full of text:


10

Look into the diff command. It's a very powerful tool, and you can read all about it by typing in your terminal man diff. The command you'll want to do is diff File_1.txt File_2.txt which will output the difference between the two and should look something like this (sorry for the lack of cropping):


0

This is basically runs Bash Script. In ./start_enb.bash "./" means the directory you are in. and "start_enb.bash" is simply name of the script. and second command is a script too. however, most scripts uses something called "Options" and "K" and "O" are some specific options for this script. You can see options and infos of the most scripts by running ...


1

After many unhappy hours trying to get the procedures in from kdmurray above to work, without success I eventually found a method that worked simply. First my Linux host (Mint 17) was set up at boot time to login automatically to my main account. Second I used the facilities in VirtualBox GUI (v4.3.12) to create a shortcut for each Virtual Machine on the ...


2

The dialog manpage mentions whiptail (in a rather deprecating fashion). It does not have the --ascii-lines option, but it does not mess up the screen either: The script: #!/bin/sh TEMP=/tmp/answer$$ whiptail --title "Administrative tasks" --menu "Tasks :" 20 0 0 1 "Display firewall settings" 2 "Restore firewall settings" 3 "Flush Firewall settings" ...


1

As McLovin says, the automatically set, readonly UID (and EUID) variable is a special feature of bash (and some other shells). It's not standard for Bourne-style shells and sh cannot be assumed to set these variables. In particular, sh in Ubuntu is (currently, by default) dash, which does not set them. You have two options: Cause your script to be run by ...


0

Read command has an option to prevent input from showing when you type it. echo "Enter the password: " read -s password #Print the password echo $password


3

Instead of executing it with sh script.sh execute it with bash script.sh (or add #!/bin/bash as the first line to set the interpreter). The sh shell in Ubuntu is not bash, but a separate shell called dash. dash does not have as many features as bash, which makes it more efficient, but these missing features sometimes break scripts intended for bash. ...


0

The precise answer is going to depend on what the startenb.bash file does - in particular whether it needs to be run from a particular directory relative to your eclipse project/build tree (when run in the terminal, where is ./ exactly?) but basically it should just be a matter of using the Location, Working Directory, and Arguments boxes in the 'External ...


0

Assuming it is a bash script, it says if the script is called with a single command-line argeument; then assign the value of that argument to the variable CONFIG_FILE_DIR and export it Exporting makes the variable visible to child shells (otherwise, variables have local scope) - type help declare at the bash shell prompt for more details about the usage ...


2

It's the X logical font description. See the full standard at x.org The 7th field specifies the size in pixel, the 8th the size in tenths of points. So the default here is "lucidatypewriter bold at 24 point". You can use xfontsel as a simple GUI to create such font descriptions.


0

The following expressions are used with integers: Table 27-3 (from tlcl's pdf book): Integer Expressions: Expression Is True If... integer1 -eq integer2 integer1 is equal to integer2. integer1 -ne integer2 integer1 is not equal to integer2. integer1 -le integer2 integer1 is less than or equal to integer2. integer1 -lt integer2 integer1 is ...


4

The line if [ 2 > 1 ]; then causes the shell to try and open a file named 1 for writing. Read the section REDIRECTION in the bash man page for an explanation. Your user1 apparently is allowed to write to that file, and user2 isn't. You were probably thinking of this: if [ 2 -gt 1 ]; then Which tests whether 2 is greater than 1, which is obviously ...


1

Create a new file (res.sh) and past it into !/bin/bash xrandr --output LVDS --mode 1024x768 and, in your terminal, type : sudo chmod +x res.sh and a create a new .desktop file into : /usr/local/share/applications/ gksudo gedit /usr/local/share/applications/res.desktop and past it : [Desktop Entry] Type=Application Terminal=true Name=Resolution ...


0

Use xdg-open it works in most linux distros. example: xdg-open /filepath/file.txt


2

Turns out each entry on the Startup Applications list gets created as a .desktop file on ~/.config/autostart$. As mentioned by both @muru's answer and an answer on the question he linked, .desktop files don't expand the tilde as the shell would. Neither they seem to have the ${HOME} variable. So the solution was to add the following line to the ...


2

Try putting them in a script and adding that script as the entry in your Startup Applications. It's hard enough to use environment variables and ~ in desktop files, let alone full-fledged command substitution, as evinced by Desktop Files don't use seem to use $PATH correctly and How to include environment Variable in launcher for icon.


0

You could us python. Save the following in a file called join.py in your home area: ffile=open('FirstFile.txt','r').read().split('\n') # Open the first file, read it and split it into a list at the newline character sfile=open('SecondFile.txt','r').read().split('\n') # Open the second file, read it and split it into a list at the newline ...


2

The default output format of join is to print the join field, then remaining fields from FILE1 and then the remaining fields from FILE2, unless the format is specified with -o. Further, the option -j4 means that join field is the 4th field in both FILE1 and FILE2. So you need to split -j4 to -1 1 -2 4 . Try this: join -o '2.1 2.2 2.3 2.4 1.2' -2 4 -1 1 ...


2

They don't. The codebase behind the runtime environments and libraries may use shell scripts as glue, but runtimes of languages like JavaScript and PHP don't depend on them. The use of commands like echo and printf are indicators of the languages the creators were influenced by, such as C and shell. This also holds true for compiled languages. Step back for ...


2

There is no relation at all between "echo" in bash and "echo" in PHP. They just happen to share the same keyword for the same action, they do not depend on each other. Often times the design of some languages influences another languages, and those that design new languages features often took inluence from existing languages. These are why many languages ...


2

Check this tool, it will help you to build the crontab line: http://www.corntab.com/pages/crontab-gui Quick answer: 30 7 * * 1,2,3,4,5,6 /your/command/to/run


0

You can use fswebcam : With the webcam connected and fswebcam installed, enter the command fswebcam followed by a filename and a picture will be taken using the webcam, and saved to the filename specified: fswebcam cam.jpg To know more about timestamps and schedule task you can visit this site fswebcam To see manual page visit this site Manpage It is a ...


0

You can use decimals in the rate. This works: streamer -t 99999999999999 -r 0.1 -o 00000.jpeg The -t argument has to be filled for some reason but the above will run for 3 billenia (yeah). You could probably lower it down a few columns.



Top 50 recent answers are included