Skip to content
Advertisement

Tag: shell

basics steps in converting xml file to html file

I would like convert a xml file to a html file. Where i can find a step by step tutorial (for linux) to do this in shell script, or which are the steps to follow. Sorry for the very basic question, but i am an absolute begginer on this. thanx Answer The basic tools to do this is XSLT. XSLT

basename with spaces in a bash script?

I’m working on a bash script to create a new folder in /tmp/ using the name of a file, and then copy the file inside that folder. Behavior: When I type in mymove “/home/me/downloads/my new file.zip” it shows this: I have lots of quotes around everything, so I don’t understand why this is not working as expected. Also, I have

Bash/sh ‘if else’ statement

I want to understand the if else statement in sh scripting. So I wrote the below to find out whether JAVA_HOME is set in the environment or not. I wrote the below script This my output to env: But I get the below output: Answer You’re running into a stupid limitation of the way sh expands arguments. Line 3 of

linux shell title case

I am wrinting a shell script and have a variable like this: something-that-is-hyphenated. I need to use it in various points in the script as: something-that-is-hyphenated, somethingthatishyphenated, SomethingThatIsHyphenated I have managed to change it to somethingthatishyphenated by stripping out – using sed “s/-//g”. I am sure there is a simpler way, and also, need to know how to get the

finding unique values in a data file

I can do this in python but I was wondering if I could do this in Linux I have a file like this I want to find all the different types of values in the 3rd column by a particular username lets say name 1. grep name1 filename gives me all the lines, but there must be some way to

Changing working directories in Linux shell in a C program

My goal is to write a C program that is like a basic shell for Linux. I have everything working except changing working directories. I have tried the system() for input strings for cd and nothing happened. I also tried chdir(“tokened string”) and also no luck. Anyone have any ideas? This is part of my code: Is it possible to

Echo to both stdout and stderr

I have a probably pretty easy beginner question: How do I echo from a shell script into both stdout and stderr? I know that I can echo to stderr echo “foo” 1>&2 but I need the output in both. I tried some Googling but nothing worked. Answer This should do it

bash scripting: how to find the absolute path of “symlink/..”?

Given two files: Upon calling parent/scripts/hello.sh from any location, I would like (in the script) to find the full path of the parent directory. In this case parent. The main issue is that parent/scripts/.. refers to generic in unix. On the other hand, everything involving regexes is not generic and may be error prone. Solutions that don’t work: All these

Advertisement