Programming :: After USB Boot - Detect Which Device The Ramfs Was Loaded From - Bash Or Python

Sep 22, 2010

How one could determine (for use in a Bash or Python script) which device (eg /dev/sda1, /dev/hda1... etc) a ramfs was loaded from when booting from a USB drive.

I have a RIPLinux/Tinycore live USB disk that automatically needs to run a script that is stored on the same USB drive but not part of the RIPLinux/Tinycore image. (Please note that I do not want to put this script into the RIPLinux image.) I therefore would like to remix the RIPLinux/Tinycore ISO to automatically run this script once it has started up. After RIP linux has booted I would like to automatically mount the USB drive that RIPLinux/Tinycore was booted from. I need help detecting which device this is.

View 3 Replies


ADVERTISEMENT

Programming :: Piping In Bash Using Python?

Dec 16, 2010

I have a bash script that I want to import in to Python, mainly just to see if I can or not. However in the script I do use some piping of commands into sed to trim it down to what I need. When I tried doing it with the os.system() call, it didn't work. The exact error is

sed: -e expression #1, char 16: unterminated `s' command

However the command that was run can be run in bash without an error. Is there a better/another way to do this? For reference the command is:

Code:

locate -n 1 wp-config.php | sed 's/wp-config.php/
/g' | sed '/wp-config.php/ d' | sed '/^$/ d'

View 3 Replies View Related

Programming :: Python To Bash Translation?

Oct 17, 2010

Ive been learning bash over the past 6 months or so and have written a few scripts etc and i have just downloaded julius to execute my scripts and a few commands with speech recognition, the example script that comes with julius to execute commands is written in python and the example works fine when executed but i would like to further extend and customize it but i dont know anything about python, so ideally i would like to translate it to bash as that is what i am learning/using at the minute and would like to learn/use one language at a time, translating it as i think im a little out of my league, i look at the script and sort of understand how it works but i dont know anything about python and my knowledge of bash is limited for use of translating languages.

the python script is:

Code:
#! /usr/bin/python -u
# How to use it:
# julius -quiet -input mic -C julian.jconf 2>/dev/null | ./command.py
import sys

[Code].....

View 1 Replies View Related

Programming :: GTK / Glade Use C - Bash - Pascal Or Settle For Python?

Dec 17, 2010

I have searched the net for guides on GTK/Glade and have learned that I have to install Glade in order to experiment with it. It also appears that it only works for Perl. I would primarily like to use C ,Bash , Pascal or settle for Python if possible. Can anyone offer some general info on this topic?

View 4 Replies View Related

Programming :: Python Passing Multiple Args To Bash

Jan 14, 2011

I have a text string I want to pass as the second arg to a bash shell.

My python line is :

The first arg "gap" works great and the bash shell uses it as $1

I need "fill" passed along as $2 intact

Here is the bash line:

As you can see after the -f it has to be in single quotes and $FILL will complete the single quote

Nothing is getting passed as a second arg from python, I did have the first word at one time but that was 85 tries ago and forgot how I did it!

The bash script complains about an unterminated quote.

View 6 Replies View Related

Programming :: Double-quotes Do Not Escape Properly (bash=python)?

May 2, 2010

I wrote the Automatik widget (you can find it at :http://kde-look.org/content/show.php...&PHPSESSID=caeTo improve it, I would like to add this one-line script into a text sensor :

top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%-12.12s %-4s %-4s %-3s
" , $12,$9,$10,$2}'

[code]...

View 3 Replies View Related

Programming :: Bash If *sometimes* Fails To Detect Embedded Newline

May 21, 2011

Using xsel I pass a selection into a variable. I then check that the variable includes an embedded newline to be sure that the selection returned by xsel is complete. If the selection content preceding the newline is just a single word, the check fails to detect the newline, thus

Code:

g fnm=`xsel`
g cat <<< "$fnm"
Whatis
apropos sear

[code]....

View 14 Replies View Related

Ubuntu :: Loaded 10:04 Onto An External Drive And Boot Can't Find It - Error: No Such Device: 4368f21f-d1b6-4c60-8c6b-4d2d38d16920

Sep 23, 2010

managed to get things working so well on my laptop i thought i'd install ubuntu onto an external drive so i can boot to either xp or Ubuntu whenever i want, when i started up after the install it doesn't recognise the drive i loaded it to and appears to have lost the link to xp. the exact words are:

error: no such device: 4368f21f-d1b6-4c60-8c6b-4d2d38d16920.
grub rescue>

what i can do to get my xp back, my wife uses the xp and will kill me if i don't sort it, fortunately the comps unrealiable anyway!

View 1 Replies View Related

Programming :: Send Block Device Name To Bash Variable?

Feb 13, 2009

I'm setting up a machine that's going to be used to test randomly connected tape drives one at a time, and as such, I'm writing the test routine using mt in a bash script, for user-friendliness. The problem is the block device name changes on occasion as tape drives are swapped out and busses are rescanned, so I can't "hard code" a block name into the script.

I know programs like lsscsi and hwinfo will give you block device names as part of their output, but I can't seem to grep anything in such a way as to have the final output be just the block name (ie /dev/st2, or optimally 'st2'), so that I can just have the script read said output, and drop it into the necessary variable.

View 2 Replies View Related

Programming :: Calling Bash Script With More Than One Variable From Python Script?

Oct 4, 2010

I am calling a bash shell script from a python script trying to pass several arguments to the bash script with no succes can this be done? I have researched (google) with no clear indication of how to achieve this. Using "os.system"

View 4 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Fedora Installation :: Device Driver For Usb To Detect Device?

Sep 19, 2009

I am currently using fedora 11 kernel 2.6.29 version, i wanted to write device driver for usb to detect my own device. My project is radio with computer. My fm radio get connected to usb port so i need to write h/w interfacing program.

View 1 Replies View Related

Programming :: Make Python Programs Run Without Entering The Command Python?

Mar 22, 2009

I want to be able to do

sudo ./program.py

instead of always having to do

sudo python program.py

What do I need to change?

View 5 Replies View Related

Programming :: Python - Get Text File Data Into An Array On Python?

Nov 30, 2009

I've already used line split stuff to transform my data into something like this in a text file:

Code:

['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']

[code]....

How can I get this on a python program so I can manipulate it as an array?

View 3 Replies View Related

OpenSUSE Hardware :: Find Out Which Driver Has Been Loaded For A Device?

Feb 2, 2010

How do you find out which driver is being used for a certain device. Say that I run lsusb and I find "Bus 007 Device 002: ID 046d:c043 Logitech, Inc. MX320/MX400 Laser Mouse", how can I find out what the active driver for the device is?Also, is there some way to list all available drivers for a device? Is there a way to change the driver at runtime?

View 1 Replies View Related

Ubuntu :: Reboot And Select Proper Boot Device Or Insert Boot Media In Selected Boot Device And Press A Key

Apr 16, 2011

Reboot and select proper boot device or insert boot media in selected boot device and press a key. I got this error after: Reducing my Windows 7 partition by about 100gb. Creating a new partition (100gb) and copying my Ubuntu partition (10gb) to the new partition. After it was copied, and pasted, the original partition was deleted. I now had two partitions a new 100gb Ubuntu partition and a 600gb (or so) Windows 7 partition.

All of this was done using a bootable USB with Ubuntu 10.10 and GParted partition editor. Now when I boot I get the "Reboot and select proper boot device or insert boot media in selected boot device and press a key." error.

View 9 Replies View Related

Ubuntu Networking :: Belkin F5D8053 Driver Loaded Still Device Not Ready?

May 18, 2010

I tried all the threads to load and compile the driver for the Belkin wireless-N F5D8053 (Ralink RT2870 chip) I still cannot get it to come up - the wireless status says device not ready. Here is some of the system info relating to the adapter:

terry@terry-desktop:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:14:bf:53:02:8f
inet6 addr: fe80::214:bfff:fe53:28f/64 Scope:Link

[code]....

View 8 Replies View Related

Programming :: Python 2.x - Represent The Same In Python 3.x

Mar 4, 2010

I have a function definition in a Python 2.x script which take a tuple as one of its arguments, but 2to3 has no answers nor any of my searching on how to represent the same in Python 3.x

Code:

def blah(self, (string1, string2))

View 4 Replies View Related

Programming :: Fail To Write To USB Device Boot Sector / What To Do?

Jul 4, 2010

I'm writing a C program that reads the boot sector of a USB disk. (it is mounted as /dev/sda1). I'm able to read the sector, by the calls code...

The problem is when I wish to write. I use the call:
bytesWrite = write(fd, buf, 512)
The 'write' returns the value of 512, which looks as if the write was successful, yet
when I read again the /dev/sda1 device, I see that no writing was actually made.

Can anybody tell me what do I need to do in order to allow an actual write to the
device?

View 2 Replies View Related

Programming :: How Can User Runs Bash Script At Boot Of PC?

Dec 28, 2008

I wanna that the pc starts (on/off), the pc arrives to gdm. It waits for an user to log.But but at the boot of this machine, I would like that an user has a script started in the processes (NO X cuz bash script).How can an user runs a script at boot of the PC ? (once only and no one loged)

View 4 Replies View Related

Ubuntu :: When Boots Into Ramfs?

Nov 14, 2010

I didn't do it, it did it on its own, anyway what does it mean?

View 3 Replies View Related

Ubuntu :: Python - Export Variables To Bash Commands?

Feb 19, 2010

I created variables in python and would like to be able to incorporate those into bash commands that will be mixed into the script. Example:

Code:
name=raw_input("Type your name and press ENTER: ")
import os
os.system( echo "name")

Of course this doesn't actually work, but i think you get an indication of what I am trying to do.

View 1 Replies View Related

Ubuntu :: Control Line In Volume In Bash/python?

Nov 14, 2010

How do i do to:1. Check if there is a audio source plugged in via line in?2. Control the volumeI want to do it through either bash or python script.

View 1 Replies View Related

General :: Write Either PYTHON Or Bash Shell Scripting?

Jun 4, 2010

I do not know how to write either PYTHON or Bash Shell Scripting. I am to learn one for Linux Administration purpose. Which one will you recommend for a Linux Admin/Eng environment?

View 4 Replies View Related

Security :: Bash And Python Scripts - Encrypt Them But Still Be Able To Execute Them Encrypted?

Aug 24, 2010

I have some bash and python scripts. Is there any way to encrypt them but still be able to execute them encrypted?

View 7 Replies View Related

Programming :: MYSQL Driver Is Not Loaded

Dec 25, 2010

I also the same problem, just that I can not proceed in the same way because I use Ubunto, what should I do to install the MySQL driver on my PC?

View 1 Replies View Related

Fedora Hardware :: Detect The Usb Device When On Cli Mode?

Oct 31, 2010

How I do detect the usb device when I'm on cli mode? This is possible or not?

View 2 Replies View Related

Ubuntu :: Cannot Detect Network Device When Using Libpcap

May 27, 2011

I use libpcap to write a program to detect network device in Ubuntu but not sucess. The result is no suitable device found. How many reasons are there for that? The code i used is the main user page.

[code]
#define HAVE_REMOTE
#define WPCAP
#include <pcap.h>
#include <stdlib.h>
#include <sys/socket.h>

[Code]....

View 4 Replies View Related

Ubuntu Networking :: 10.04 Can't Detect The Wireless Device?

Jun 24, 2011

My computer is Dell Inspiron N4020.And after I installed the Ubuntu 10.04 successfully,a problem occured:No wireless device appear nor the wireless signal

View 1 Replies View Related

Ubuntu :: Detect And Install A Mic Device Driver?

Jan 8, 2010

how to detect and install a mic device driver? i only plug and play the mic in xp.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved