[Solved] Uploading to an FTP server

I don’t know C++/CLI, but the following statement is certainly wrong: _FtpWebRequest->Method = System::Net::WebRequestMethods::Ftp.UploadFile; System::Net::WebRequestMethods::Ftp is a type and, as the error message indicates (you could have given us the line number!) you’re trying to use it as an expression. Are you trying to obtain a pointer to a static member function? Did you thus … Read more

[Solved] What is the meaning of pwd|sed -e?

So first you should know that this is two commands – pwd and sed -e “s#/survey1##” – and these two commands are being run together in a pipeline. That is, the output of the first command is being sent to the second command as input. That is, in general, what | means in unix shell … Read more

[Solved] making a shell with C

Your third argument (a[2]) has a newline character at the end. ls thus complains that it can’t find a directory named with a single newline character under your home directory. Fix your command parsing to not include the newline. 3 solved making a shell with C

[Solved] Sort words and then the sentence including digits and characters in Shell scripting or perl scripting [closed]

The algorithm to sort this problem is simple, just like you said in your question description, sort characters in each word first, then sort these sorted-word again. Like this: $ echo heya64 this is21 a good89 day91 | perl -anE ‘say(join ” “, sort(map { join “”, sort split // } @F))’ 12is 19ady 46aehy … Read more

[Solved] reading properties from ini file in a bash script

It can be done pretty easily using Awk, just do the below to store the contents in a bash array. read -p “Enter object to get properties for: ” objectname all_properties=($(awk -F ‘=’ -v input=”${objectname}” ‘$1 ~ input{flag=1; next} $1 ~ /\[object/{flag=0; next} flag && NF {split($0,arr,”=”); print arr[2] } config.ini)) Now loop the array … Read more

[Solved] Run a shell script on boot in ubuntu [closed]

Probably you want it to run at the time of login. Put it in .bashrc If you want to see it before login to tty0-tty6, put the text “Welcome Davide, have a nice day” in /etc/issue. [Adition by fedorqui]: If you want it to be displayed on tty0-6 AFTER login, put it in /etc/motd. This … Read more

[Solved] Replacing first occurrence of comma in unix shell script

sed is your friend. The result can be stored in a new file. Give a try to this tested command below: sed s/,/\’,\’/ file.txt > result.txt The sed man page contains information. The test output: $ cat input.txt apple,orange,house foo,bar,woops $ sed s/,/\’,\’/ input.txt > result.txt $ cat result.txt apple’,’orange,house foo’,’bar,woops solved Replacing first occurrence … Read more

[Solved] shell script to backup system [closed]

Here is a solution that requires no subshell or external program, does not parse ls output (which is not recommended), and should work with filenames containing spaces (or even newlines). You can customize your prefix and extension. #!/bin/bash dir=”/path/to/files” prefix=”backup#” ext=”.tar.gz” max=1 for file in “$dir/$prefix”* do [[ $file =~ /$prefix([0-9]+)$ext$ ]] || continue n=”${BASH_REMATCH[1]}” … Read more

[Solved] Linux ‘cut’ command line and replace

This should do the trick: #!/bin/bash INPUT=”$@” SIZE=${#INPUT} for ((i=0; i < ${SIZE}; i++)); do echo “${INPUT}” INPUT=”${INPUT:0:${i}} ${INPUT:$((i+1)):${SIZE}}” #INPUT=”$(echo “$INPUT” | sed “s/^\(.\{${i}\}\)./\1 /”)” done I added a sed option in the comment, although it creates a sub-process when you don’t really have to. 0 solved Linux ‘cut’ command line and replace