Programming :: Adding New Selections To The Existing Script?
Mar 19, 2010
i have two scripts called:
"type" & "selecttype".
In "type" i have only the name of the products ex.: product1 & product2. Now, i have to ADD product3 which includes sub categories: productA, productB, productC, productD, productE, productF. so my New type script (menu) looks as below:
1) product1
2) product2
3) product3
and my current selectype looks how can I add the new product3 argument with all other multiple selections (productA, productB, productC, productD, productE, productF) into my current selectype (as below which is set only for product1 & product2), so when a user select: 3) product3 from "type" would get a new menu of all the sub categories, and the script would process the new additional arguments.
Here is the copy of my selectype script:
#!/bin/sh
echo SELECTTYPE
export -n selecttypechoice
if [ "${upgrade}" == "yes" ] ; then
i have two scripts called: type & selecttype. In type i have only the name of the products ex.: product1 & product2. Now, i am going to ADD product3 which includes productA, productB, productC, productD, productE, productF. so my new type script (menu) looks as below:
1) product1 2) product2 3) product3
and my current selectype looks as below ( which is set only for product1 & product2)my question is how can include the new product3 with all other multiple selections (productA, productB, productC, productD, productE, productF) into my current selectype as below:
I'm using zenity 2.28.0 in a bash script (under kde4) to select multiple files in a directory. It works fine, but always defaults to showing hidden files. How can I get it to hide hidden files by default?
I know about toggling them on and off with Ctrl-H, but I would prefer not to have to use that. I have my options set so that dolphin and konqueror do not show hidden files by default. I even tried adding shopt -u dotglob to my script. zenity invocation (extracted from a more complex statement): zenity --title "Select Print Files to Delete" --file-selection --multiple
I've been asked by my professor to add the list of users to a linux server (not sure of the OS type I think he said debian) but anyway. He gave me this script to add users.
Code: #!/bin/bash # Script to add a user to Linux system if [ $(id -u) -eq 0 ]; then read -p "Enter username : " username read -s -p "Enter password : " password egrep "^$username" /etc/passwd >/dev/null if [ $? -eq 0 ]; then echo "$username exists!" exit 1 else pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) useradd -m -p $pass $username [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" fi else echo "Only root may add a user to the system" exit 2 fi
I need to see if I can get this script to read a file that list the usernames and their passwords using the pipe command (or some similar command) so I can just do it in one batch. I've done some searching but there are so many vairiations of the code that I've confused myself. Also, I'm not too familiar with linux, it's been a few years since I've used it but in the prior script, I need to add the users to an existing group named "forensics". Which line would I change/add in order to do this?
I want to move my windows XP image from my old PC's C: and put it onto my new PC, with Ubuntu 9.10 already on it. Will this procedure work?First I'll burn an iso image of the windows C: to a CD or DVD, using the Win XP computer. Then, I'll load a (live Ubuntu), from my thumb drive and boot into my new PC, and move the Ubuntu partition to another location, in order to create the partition needed to install a Windows OS. I know that Windows, God bless them, needs to be first on the HDD. This procedure will destroy the grub loader.Then rebooting should load correctly to the grub bootloader, right?
I have an existing Fedora 15 system installed from scratch.I've ordered a harddrive identical to my SDA and want to add it to my existing system as a RAID1 setup.I've googled around and cannot find recent clear instructions how to accomplish this. I don't want to reinstall everything from scratch. It should be possible to create the RAID1 using the existing data disk and then mirror everything up?
After spending almost 100 hours trying to get my MP3 player working I have decided to add an XP partition and use it there.I am an Ubuntu newbie and am finding the whole "new-dos" experience too frustrating for words.Can someone please explain in ENGLISH for an IDIOT how I can do this.
I have an existing network that connects to the 'net via a Linux-based firewall. That system has two ethernet interfaces: one to the DSL modem and the other to the internal switch. Future plans were for adding a second "internal" interface with the idea of moving servers into that (think DMZ). But while I was planning for that, the missus has decided she wants to pick up a Windows laptop and would like to be able to use it wirelessly at home. I have access to a (free!) Netgear WGR614L and was hoping it would work. Unfortunately, I'm unsure how to add the wireless capability to our network.
Questions:
Is it best -- or even possible -- to use one the wireless router for this?
Is it possible to merely hang the Netgear router off the internal switch and set it up for the wireless users? Or...
Would I need to add another ethernet interface to the firewall and hang the router off that? The address of this new interface would act as the default route for the wireless users. Then I'd need to (I assume) add more rules to the iptables configuration to deal with the new network. (I sort of like this option -- it it's actually feasible -- as I can easily shut down any wireless access by logging into the firewall and stopping the interface connecting the wireless router.)
I've taken a look at the setup guide on the CD that came with the router and it assumes that you have a modem connecting your PC to the internet. The instructions have you placing the wireless router between the modem and that PC. For our network, that would have the wireless access coming into the "dirty" side of the firewall. (Not what I would like.)
I have 2 image files, image 1 which is 16MB, has multiple partitions, where the boot partition has a 2.4 kernel in it, and image 2, which is 32MB, has a single partition with a 2.6 kernel.
I wish to add those extra partitions from image 1, into image 2, either by adding them within the 32MB(which means cutting back on the size of the existing partition), or adding them to the end of the image(which means extending the image beyond 32MB).
The boot partition for both images is ext2, while the rest of the partitions in image 1 is just raw data.
I'm working with these images in Mandriva Linux 2009.
How can I achieve what I want to do? I think it should be with fdisk and/or mkfs but I'm not sure how? I've tried using gparted to regenerate the partitions from a new image file with the following steps: dd if=/dev/zero of=image.img bs=32M count=1 gparted image.img
Then I created a 30M boot partition. However, I'm not able to create the rest of the partitions as they are smaller than 1MB, which seems to be the min supported. I need precise control of the start/ending sectors of each partition.
I installed Ubuntu in a dual-boot with Windows 7, and installed the bootloader (GRUB? However, I have some weird Windows XP Embedded entry! I also have a lot of different boot options for Ubuntu. All I want is my Windows 7 entry (picked up as Windows Vista) and my main Ubuntu entry. How can I edit the bootloader entries (remove some existing ones, not adding any) so I have only two on there?
Have 3 linux distros on 3 hard drives. lost one distro from boot loader. how do I restore missing distro to boot loader? drive was not written to when one distro (drive) was updated.Example drives a, b, and c each had listing on boot loader, now after upgrade to distro on drive b order on boot loader is drive b then a and none for c.
I have a running RHEL5 system, which has two physical disk drives, but is currently running on a single drive of the pair. The single drive the system is running on contains a root/boot partition and a swap partition. I would like to be able to add a mirror drive to this existing setup without having to disturb the running system (much). That is, I don't want to have to completely dump, reinstall (creating the mirror on the way up), and reload from backup media if I can avoid it. I have seen procedures that go as follows:
- the "extra drive" (the one not being used as the current root/boot device) is first brought under LVM control as a root object with one physical mirror attached.
- the data from the running root/boot drive is rsync-ed over to the LVM-controlled half-mirror, and boot records added.
- System rebooted on newly created half-mirror.
- Original root prepped to be second side of LVM mirrored root, and is added in.
Can one boot from an LVM disk directly? There seems to be some question on this that came up in other lists I had read online.
Is there an easy way to add SATA drives to an existing system and have them m automatically at boot?So far I've been able to create a partition and format but they never mount at boot.What do I have to put in fstab so it will work?Also, since RAID doesn't work in Debian, is it possible to make two drives mount at the same folder
I have a BIG extended partition. It's at about 750Gb. Aside from that, I have 2 unallocated spaces, one at 240Gb and one at 5Gb. I want to make one of my storage drives bigger, and so that I can take advantage of all the space I have. (Those 250Gb have been unused for ages. I want to use them for my growing libraries.) So I wonder: would it be safe to put these smaller "chunks" into the extended partition, and still have a working systen? I don't want to mess it all up.
Also, can I safely resize a partition, like adding the extra space, without touching the existing data? I'm not exactly sure how the resize/move function in GParted works. Will it wipe and extend or only extend it by adding it? It would be nice to have these questions answered. Also, if it's to any help, this is my partition table as of now:
[Code]....
As for the first entries, they're unallocated. They're the primary drives, but they don't exist. I'm actually considering to move my partitions out of the extended one, because I only have 3 partitions that I use and will ever use. But if the extended partition is not a problem, I will just keep it this way.
I'd imagine that I first extend the extended partition to consume the unallocated space, and then I move it all to the end of the partition, and then resize sda7 to consume it, and get a 750Gb partition. Can this be done without loss of data?
i inherited 200 tables in a mysql db from each of the 200 table there are table created on php pages
the information is organized pretty much the same (fields) in each of them, so i dont see the point of having so many different tables
i wanna redesign the db, in 4 tables each of this 200 table have a few essential characteristics, like: table name is (version_country_type), ie: v8_de_pro, v8_de_std, v9_uk_pro the fields are: No, Document_file, Document_path, ISBN, Book_Name, Subtitle, Status, Year_issue, Author
i will need to break the table name, and put each part in the new redesigned 4 tables separate fields... ill have something like:
but i have no idea how to do it i know i cant do it in mysql... so ill need to build up a php script which will need to read every table, and drop it in the new format:
table1 called Main: ID, version table2 called Cat: ID, IDmain, Country table3 called Sub: ID, IDmain, IDcat, type table4 called files: ID, IDmain, IDcat, IDsub, Document_file, Document_path, ISBN, Book_Name, Subtitle, Status, Year_issue, Author
What I would like to do is, with a right click, have the menu give me the option to run srm, which is a "secure remove" program. I picked this one as it requires not only a file name, but some other options. I've run into no support adding things to menus. When I updated one of the Debian versions, I lost the shutdown option from the name menu that used to be there. It was suggested that I right click and pick that option to restore it, but I get the same as the left button on that menu.
I have a LAMP based web hosting account (BlueHost). I have an existing simple MS Excel application which I would like to make it web based. However I am not sure what tools or features of PHP are out there that will aid me with this task. Here are some details:
1. I don't want to create an entire Excel program online. For that there are plenty of existing applications like Google Docs, MS's own online version of Excel, etc. 2. My current excel file uses some of the following excel functions: a) SUM b) Product Sum c) Conditional Formatting (like changing font color if an amount is below a threshold, etc.) d) Sorting (Date, Amount) e) Drop Down Box to select pre-defined values
3. Ability to add/delete/modify a entry (row) 4. I don't care whether the application has the same look-n-feel as MS Excel.
As you can see it is a very simple home grown excel application with few basic mathematical functions. Here are some few thoughts that I have currently in my mind:
i) Just start coding intuitively as you would develop a normal web based application. ii) Do (i) but use some of the PHP's excel oriented helper functions (COMs?) if there are any iii) Use completely a different set of tools permitting that they run on LAMP environment.
I could have started with (i) but before making a costly mistake I thought I would get some opinion from the community to see if this is the right approach.
I have lately found myself setting up a number of PXE installation servers sufficient that I'm now inspired to automate the process. I've not done this before, but I think I've hit on a method to make it work. I'm using three packages from the archive as a basis: tptpd-hpa, isc-dhcp-server, and nfs-kernel-server. Up to now I've been installing these with APT, then modifying their configs (or creating same as necessary) and then copying my install files (pxelinux.0 and friends, with Debian Wheezy netinst and Xubuntu 14.04 menu options) into /srv/tftp. It strikes me that, rather than letting these packages' postinst scripts do a bunch of stuff that I will subsequently undo, I should modify the scripts in situ to do what I want. I don't feel that I adequately understand how these things work, so I'm asking for advice. So far I've hit upon two different methods.
I can use apt-get download to fetch the packages, and then dpkg-deb --control to pull out the control files. Then I can edit the postinst scripts as necessary and dpkg-deb --build a new package from the results of dpkg-deb --fsys-tarfile plus the altered postinst scripts. I have gotten as far as extracting the control files from a package, but I'm unsure that the dpkg-deb --build step will work as I expect. Alternately I can do apt-get source [packages], edit the postinst scripts in the source, and then build the packages as usual. I'm more confident that this will work, but I'd rather provide the former method if possible. Is there another method of which I've not thought? Is this the way metapackages are made and configured?
How can I write to a file multiple times using fwrite without affecting the previous writes?The method shown below accepts a file name, buffer and offset. The method opens the file in reading/writing mode and writes the content of the buffer at offset.
void setplane(unsigned char mask){ inportb(0x3DA); //Reset the VGA flip/flop unsigned char c=inportb(0x3C0); /*the VGA does not like you not saving values*/
[code]....
does not work, for example if setplane(1); will change all pixels plotted to blue - not just the newest. and here is how i plot pixels:
Code:
void ppixel(unsigned x, unsigned y, unsigned char color){ setplane(color); ((char far *)0xA0000000L)[(y*(640/8))+(x/8)]=((1<<7)>>(x%8)); }
I have an existing unix user that some how didnt make it into the copy over to our LDAP server. How do I add an existing unix user to an existing LDAP directory? Will ldapadd work? I was under the impression ldapadd required an ldif file to work properly.
I've tried this with 4.0r3 and 4.0r7 CDs, using two different networks to access repositories, and the same result each time: install goes fine until the "OK" for the "Desktop/Web Server/Mail Server/etc." selections, it brings up the "Select and install software" page and then it freezes, showing "5%" and "Please wait..." under the progress bar.
If I hadn't built 20+ servers this way I'd think it was me, but it's not... I think. What's going on?
(No, we're not upgrading to 5.0. Reference above mention of lots o' servers! )
I'm trying to install wine1.3 but I don't want the (recommended) package ttf-mscorefonts-installer.In previous releases, I can run this to 'hold' the package and prevent it's installation:
Code: echo ttf-mscorefonts-installer hold | sudo dpkg --set-selections.However, this command doesn't prevent ttf-mscorefonts-installer from being installed along with wine1.3 in maverick.[code]....
it's just that dpkg isn't picking it up.What is going on here, and how can I place a package on permanent hold?
Note: I ended up installing wine1.3 by running:
Code: sudo aptitude install wine1.3 ttf-mscorefonts-installer= but I don't believe that the package is actually on permanent hold.
how would i highlight multiple selections in a graphical text editor such as gedit, kwrite, kate, leafpad, etc. is it possible? for example; if i wanted to redact a document by removing several different words throughout the document.
i could probably learn vim or nano and regular expressions without too much trouble if those would work better.
I have a problem on a program,the problem take a very long time when i try to add two big arrays element by elementI know that matlab make adding vectors more faster than adding element by element but I don't know how!!!do any body knew how matlab make vectors operations more faster than element by element???I want to make my calculation more faster because the program is very big