General :: Creating A Shell Using C Which Could Implement LS Command
Sep 4, 2010I would like to create the shell which would support the LS command in C++. And the way the command prompt can be changed.
View 7 RepliesI would like to create the shell which would support the LS command in C++. And the way the command prompt can be changed.
View 7 RepliesI have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct
So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/
Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.
Is there any function like mkdir() or link() for command ls? If not, how is ls implemented?
View 4 Replies View RelatedIn a shell script, I am creating a .tar using this command
Code:
tar -zcvf dst/lib/library.tar.gz dst/lib
There are two problems:
[code]...
I am in deeply need of queue (linear data structure) in shell script. How can I implement this ??
View 2 Replies View Relatedi need the source code to create my own shell in linux or provide atleast procedure for doing it
View 9 Replies View RelatedI am looking into creating my own terminal command from scratch. I researched online for some information on this subject was only able to view stuff related to OS X. I understand that they are both Unix based, are they both similar in creating these commands? Basically all I would like is for someone to point me towards the right direction to start or complete this task.
View 11 Replies View RelatedI encountered a question in the Redhat Skills Assessment regarding useradd: Which of the following cannot be defined when you create a user account with useradd?
a* A password expiration date.
b* The user's primary group.
c* The user's default shell.
d* The user's NIS or LDAP group.
e* The user's home directory.
Which is the correct answer? I have my own thinking which will be explained later.
I want to create a Live USB ..I have the ISO image in the hard disk
Where Sdb is my USB
The copy operation is okay...It says no of records in / out and gives the statistics
But when I boot the system , getting the error:
Boot :
In some cases , the USB itself is not recognized by BIOS at boot..
My BIOS supports boot from USB ..I have Boot order 1. CD/DVD 2. USB 3. HDD
Also what is the filesystem to be adopted for dd?
I usually format using FAT or FAT 32
1.mkfs.vfat /dev/sdb -I (or)
2.mkdosfs /dev/sdb (or)
3.mkdosfs -F 32 /dev/sdb
What is the correct way of partitioning USB drive? - FAT or FAT 32....Most Live USB creators (unetbootin/LiLi Live/Usb Creator) recognize only FAT32...
I dont want a Linux filesystem (ext2,ext3 or 4or reiserfs)for my USB as it is not portable across many systems as MS OSes do not read them..Also I had little success in booting a USB when I partitioned it using ext2..I read somewhere that ext2 will not reduce the life of the USB drive compared to other fs.
I'm trying to create a user john with default password 'abcdef'. I used the following command.
useradd john -p abcdef
I can't login with the password. in /etc/shadow file I can see the password in clear text format. how I can create a user along with password.
I recently used the newusers command to generate several user accounts from a text file. That process seemed to go well until I tried to su into one of the new accounts.
This behavior appears for all the accounts that were created from the text file and the newusers command. It seems that several configuration files that should have been autogenerated for these new users were never created. I was able to confirm this was the problem by copying .bashrc and .bash_profile from a user that was created with the "useradd" command into the /home/newaccount directory. After logging off and logging into the newaccount again, the issue is corrected.For the record, I just read this forum post and I'm looking for an alternative to this. If this is the most efficient way to accomplish my goal, then I'll try the route mentioned in the thread. I'm still open to alternatives.
I am using Red Hat Linux Enterprise version 5. I've noticed people sometimes running commands with a couple of & options. For example, in the below command, there are two & signs. What is the purpose of them? Are they always used together with nohup?
nohup foo.sh <script parameters> >& <log_file_name> &
I can do:mkdir messages and then: touch messages/hello.txt Is there a command that will do both - create the directory if it doesn't exist, and then the empty file? Something like: touch -p messages/hello.txt
View 1 Replies View RelatedI'm looking for a specific command,if it exist... i want to login from my server to another Linux server,but the question is: can i do it in a one line command for ex:
usually you type: ssh "user"@10.1.1.1 and then the password,but I'm looking for a command in one line a fake ex: ssh user@10.1.1.1 -p "password" something like that.
I don't know if anyone of you understand what do i want to say .
I'm writing a shell script to check the I/O activity of a Linux box and if the server is quiet for a certain long time, the script should let the server go to sleep. But, after some Google searching, I didn't find a answer yet. Is there a shell script command to put a Linux box to sleep?
View 3 Replies View RelatedI tried to execute a shell command by M-! cmd RET but it did not work.M-! does not turn up in the microbuffer no matter how many times I press Alt+!.But if I go to Tools menu and select Shell Command... option then it writes M-! to the microbuffer and everything works fine.What is the problem here?
View 2 Replies View Relatedi have a text file generated automatically from a script , but the result in the script is not ordered in a readable way, so i need your help to fix it using a shell command the text file contain data in this way :
Code:
0.147361 0.243688 0.081520 -0.446603 1.130529 NC_000846 Chordata
Rheiformes
Aves
0.091740 0.379224 0.021160 -0.088493 3.441356 NC_000857 Arthropoda
Diptera
[code]....
i want to arrange the data in this text file in a way that each line will concatenate the 2 lines after it , so that will be 1 line , i want all the lines to be treated in this way ,
Reading a BASH script, I saw a find command preceded with a backslash. It was similar to this:
Code:
`find . -type f -name '*.xml' -print > xmlfilelist`
It's impossible to find documentation about this in man pages or on the internet, since 'backslash' are always evoked along with special characters. I also noticed that even though the command was surrounded with backquotes, the result was not affected to any variable. Maybe the backslash's presence is related with this?
I would like to create the shell which would support the LS command in C++. And any way to change the command prompt.
View 1 Replies View Relatedshell command to display contents of a file? Like that of .txt or .html
View 9 Replies View RelatedHow can I pipe the output of a shell command into a new buffer in Vim? The following obviously wouldn't work, but you can see what I'm getting at:
:!echo % | :newtab
I have a problem to make a shell, using mail command DestMail= cat /opt/scripts/maillist.txt mail -s"SUBJECT" $DestMail -- -r xxxxx@gmail.com < /opt/scripts/test.txt where: maillist.txt contain email adresse separated by comma test.txt mail text this script can eval DestMail variable!!
View 1 Replies View RelatedWe use a SLES 10 SP2 file server. This file server has all type of files. We want to know what is the amount of space used by mp3 files. What we need to know is the total space in disk of mp3 files. I've been testing du command, and find command, but with no satisfactory results. Does anybody know how to do this?
View 11 Replies View RelatedWhen i change the directory using 'cd', the length of my shell prompt keeps on increasing. To make it more clear kindly see below
Code:
$> cd MyWorks
$ Myworks> cd Shell
[code]....
I am unable to use clear or cls command on bash shell. I have recently installed Cygwin and am using that for practicing unix commands.
I see that I can use Ctrl + L to clear the screen. I created an alias in my .bashrc to do the same as
alias cls='^L'
This is how i defined other aliases e.g.
And they work. Hence I assume cls will work too but this is what I get when I try to give cls on command prompt. Am i missing something? Is there a way to do this?
Then someone suggested, You cannot alias keystrokes to commands or vice versa. You could just alias cls to an echo command: echo -en "x0c"
And I added the following to .bashrc,
Sourced the .bashrc file. No errors but cls still does not clear the screen. Infact when I typed the echo -en "x0c on command prompt as well, nothing happened. What does this command do?
How can i do that.. Today is my first day writing a script.. and correct me if this Thread should be somewhere else..
Code:
if [ $1=$anyvariable ]; then
ssh www.a.com <Have to set few variables and give commands >
I want to visit a url but this shall be invoked by a shell script. Anyone let me know the command to hit a url in unix.
View 5 Replies View RelatedConsider that I am building my application in Linux shell using make command but somehow the build fails. Is there any way I can find out that the build has failed (of course looking at shell for error messages will do the job for me but I don't want that). Is there any flag make or shell will set/reset if such failure occurs ?
View 5 Replies View Relatedhow to do in Debian
1. am required to create a bash-shell script called terminator that terminates all processes of a name given to the shell script as an argument. Make sure the terminator shell script will not take any crucial file system services as arguments.
2. Show how you would configure an Ethernet card by reapplying your existing IP and network mask
3. Install a workable nfs file sharing system between your system and a remote system, using optimum values for resize and wsize.To demonstrate send a 512Mb block of random data between client and server using the dd command.Write down the relevant steps and procedures
`cat /var/log/secure | grep "refused connect" |awk '{print $9}'|sed 's/::ffff://g'|uniq -c | sort -nr |head -2 | awk '{print $2}' >/root/sample`
for IP in `cat /root/sample`;
[code]...